I am trying to use a conversion character to count the number of chars printed so far with the following code.
#include
int main(void) {
It looks like this is a Windows issue, this article says:
The default C-RunTime Library (msvcrt.dll) on Vista seems to have %n disabled by default - security reasons of course
It looks like there is a _set_printf_count_output to enable it.
BLUEPIXY found that in order to get it working outside Visual Studio you need to define __USE_MINGW_ANSI_STDIO:
#define __USE_MINGW_ANSI_STDIO 1
use compile option -D__USE_MINGW_ANSI_STDIO
E.g
>gcc prog.c -D__USE_MINGW_ANSI_STDIO
or
>clang prog.c -D__USE_MINGW_ANSI_STDIO
Another solution is placing this command above the first import statement like so (see below). This will ensure that the ANSI I/O standards are preferred over Microsoft's. More information in this link here.
#define __USE_MINGW_ANSI_STDIO 1
#include <stdio.h>