EASTL
EASTL copied to clipboard
printf buffer is not accumulative in android
the following does not work as the buffer is not accumulative
#define LOG_INFO(...) { \
EA::StdC::Printf("INFO: " __VA_ARGS__); \
EA::StdC::Printf("\n"); \
}
in the second, the buffer is replaced with "\0FO: " ...
#include <EAStdC/EAStdC.h>
#define LOG_INFO(...) do { \
char logBuffer[256]; \
EA::StdC::Snprintf(logBuffer, sizeof(logBuffer), "INFO: " __VA_ARGS__); \
EA::StdC::Printf("%s\n", logBuffer); \
} while (0)
int main() {
LOG_INFO("This is a log message: %d", 42);
return 0;
}
Is there a way to immediately flush the buffer after every call to the last EA::StdC::Printf
?
I can't find a EA StdC flush function. You can just call fflush(stdout);
directly.