_set_printf_count_output() appears broken under Windows 7
Microsoft in their infinite bloody wisdom have by default disabled the %n specifier in printf (and all variants thereof).
You can re-enable it with this function; _set_printf_count_output().
I have used this - some time ago in the past - and it worked.
Now it isn't working. Platform is latest SDK on Windows 7.
Anyo开发者_开发百科ne else finding this?
Program:
int _tmain(int argc, _TCHAR* argv[])
{
int count;
_set_printf_count_output(1);
printf( "1234567890123456%n78901234567890\n", &count);
printf("%d\n", count);
return 0;
}
Output:
123456789012345678901234567890
16
精彩评论