gpt4 book ai didi

c - _set_printf_count_output() 在 Windows 7 下出现损坏

转载 作者:可可西里 更新时间:2023-11-01 12:05:30 26 4
gpt4 key购买 nike

微软以其无限的血腥智慧默认禁用了 printf(及其所有变体)中的 %n 说明符。

您可以使用此功能重新启用它; _set_printf_count_output()。

我曾经使用过这个 - 过去一段时间 - 并且有效。

现在不行了。平台是 Windows 7 上的最新 SDK。

还有其他人找到这个吗?

最佳答案

程序:

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

关于c - _set_printf_count_output() 在 Windows 7 下出现损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5046238/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com