FPL provides a couple of functions for writing text to the console and reading a single character from it.
These work with the standard output and standard error streams.
- Note
- To get an actual console window on Windows, include the fplInitFlags_Console flag when calling fplPlatformInit() .
Writing text
Use fplConsoleOut() to write plain text to the standard output and fplConsoleError() to write plain text to the standard error stream.
fpl_platform_api void fplConsoleOut(const char *text)
Writes the given text to the standard output console buffer.
fpl_platform_api void fplConsoleError(const char *text)
Writes the given text to the standard error console buffer.
Writing formatted text
For printf-style formatting, use fplConsoleFormatOut() for the standard output and fplConsoleFormatError() for the standard error stream.
Both take a format string followed by a variable number of arguments.
int frame = 42;
fpl_common_api void fplConsoleFormatOut(const char *format,...)
Writes the given formatted text to the standard output console buffer.
fpl_common_api void fplConsoleFormatError(const char *format,...)
Writes the given formatted text to the standard error console buffer.
Reading a character
Use fplConsoleWaitForCharInput() to block until a single character is typed into the console input, and return it.
fpl_platform_api char fplConsoleWaitForCharInput(void)
Waits for a character to be typed in the console input and returns it.
Notes