微软在他们无限血腥的智慧中默认禁用了printf中的%n说明符(及其所有变体)。您可以使用此功能重新启用它;_set_printf_count_output()。我用过这个--在过去的一段时间里--而且很有效。现在它不工作了。平台是Windows 7上的最新SDK。还有人发现这个吗
a0zr77ik1#
项目:
int _tmain(int argc, _TCHAR* argv[]) { int count; _set_printf_count_output(1); printf( "1234567890123456%n78901234567890\n", &count); printf("%d\n", count); return 0; }
输出:
123456789012345678901234567890 16
(来源:typepad.com)
1条答案
按热度按时间a0zr77ik1#
项目:
输出:
(来源:typepad.com)