使用系统时printf没有输出

0 c

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

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;
}
Run Code Online (Sandbox Code Playgroud)

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

nos*_*nos 6

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

printf("%s\n",command);
Run Code Online (Sandbox Code Playgroud)

要么

printf("%s",command);
fflush(stdout);
Run Code Online (Sandbox Code Playgroud)