UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
console.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#include "egttypes.h"
4
5//
6// All users of the console abstraction need to use
7// CONSOLE_MAIN as the main definition.
8// eg
9// CONSOLE_MAIN
10// {
11// console_init();
12// // do stuff
13// for (;;)
14// {
15// console_handleevents();
16// // do stuff
17// }
18// return 1;
19// }
20
21
22#ifdef __RAD_NDA_PLATFORM__
23
24 #include RR_PLATFORM_PATH_STR( __RAD_NDA_PLATFORM__, _console.h )
25
26#else
27
28 #if defined(__RADANDROID__)
29 #include <android/log.h>
30 #include <android_native_app_glue.h>
31
32 static void console_printf(const char *fmt, ...)
33 {
37 va_end(arg);
38 }
39
40 static void console_init() {}
41 static void console_handleevents() {}
42 #define CONSOLE_MAIN extern "C" int main(int argc, char** argv)
43
44 #elif defined(__RADNT__) || defined(__RADWINRT__)
45 #include <conio.h>
46 #include <windows.h>
47 #include <stdio.h>
48 static void console_init() {}
49 static void console_handleevents() {}
50 #define CONSOLE_MAIN int main(int argc, char** argv)
51 static void console_printf(char const* fmt, ...)
52 {
54 va_start(args, fmt);
55 vprintf(fmt, args);
56
57 // this flush is here so that when we run from a parent exe, we don't get
58 // hit by the buffering behavior that the vc crt adds if the filetype of
59 // stdout is a pipe. We print rarely enough that the perf shouldn't matter.
61
62 va_end(args);
63 }
64
65 #if defined(_MSC_VER)
66 #pragma warning(disable: 4505) // unreferenced static function
67 #endif
68
69 #elif defined(__RADLINUX__) || defined(__RADMAC__)
70 #include <stdio.h>
71 #include <termios.h>
72 #include <unistd.h>
73 #include <stdlib.h>
74
76 static int peek_character = -1;
77
78 int _kbhit();
79 int _kbhit()
80 {
81 unsigned char ch;
82 int nread;
83 if (peek_character != -1)
84 return 1;
85
86 new_settings.c_cc[VMIN]=0;
88 nread = (int)read(0,&ch,1);
89 new_settings.c_cc[VMIN]=1;
91 if(nread == 1)
92 {
93 peek_character = ch;
94 return 1;
95 }
96 return 0;
97 }
98
99 int _getch();
100 int _getch()
101 {
102 unsigned char ch;
103 int i;
104 if(peek_character != -1)
105 {
106 ch = (unsigned char)peek_character;
107 peek_character = -1;
108 return ch;
109 }
110 i=(int)read(0,&ch,1);
111 if (i!=1)
112 ch = 0;
113 return ch;
114 }
115
116 static void console_cleanup()
117 {
119 }
120 static void console_init()
121 {
122 setbuf( stdout, 0 );
125 new_settings.c_lflag &= ~ICANON;
126 new_settings.c_lflag &= ~ECHO;
127 new_settings.c_iflag &= ~ICRNL;
128 new_settings.c_cc[VMIN] = 1;
129 new_settings.c_cc[VTIME] = 0;
132 }
133 static void console_handleevents() {}
134 #define CONSOLE_MAIN int main(int argc, char** argv)
135 #define console_printf printf
136
137 #endif // public platform
138#endif // nda platform
OODEFFUNC typedef const char int const char * fmt
Definition oodle2.h:678
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
s expects dereferenced FString s expects ANSICHAR *or UTF8CHAR s expects ANSICHAR *or UTF8CHAR *but got TCHAR *use ls S expects dereferenced FAnsiString or FUtf8String S expects character pointer but got S expects ANSICHAR *or UTF8CHAR S expects ANSICHAR *or UTF8CHAR *but got TCHAR *use s hs expects dereferenced FAnsiString or FUtf8String hs expects ANSICHAR *or UTF8CHAR hs expects ANSICHAR *or UTF8CHAR *but got TCHAR *use s ls expects character pointer but got ls expects TCHAR ls expects TCHAR *but got ANSICHAR *or UTF8CHAR *use hs c expects ANSICHAR or UTF8CHAR p expects a pointer unsupported format not enough arguments provided to format string d expects integral arg(eg. `char`, `int`, `long`, etc.)") X(ZNeedsIntegerArg
else console_printf("Succeeded.\n")
console_handleevents()
args
Definition TestServer.py:519
int
Definition TestServer.py:515