gpt4 book ai didi

c - 使用系统时 printf 不提供输出

转载 作者:太空宇宙 更新时间:2023-11-04 05:08:24 24 4
gpt4 key购买 nike

我有以下代码(部分代码):

snprintf(
command,
sizeof(command),
"%s -o %s -n \"%s\" -st %s -et %s -a \"%s\"",
_pcOPMTRExePath,
_pcTempFile,
l_acHostName,
_pcStartTime,
_pcEndTime,
l_acMessage
);
printf("%s",command);
l_iRetValue = system(command);
/* Return an error if failed to copy*/
if(l_iRetValue!=0)
{
printf("18");
return INTERNAL_ERROR;
}

问题是系统命令工作正常。但是我的 printf 没有给出命令值。这是内存溢出还是类似的问题?

最佳答案

可能只是 stdout 没有被刷新 - 通常 stdout 在连接到控制台时是行缓冲的。试试看

printf("%s\n",command);

printf("%s",command);
fflush(stdout);

关于c - 使用系统时 printf 不提供输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2310213/

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