谁能告诉我为什么这个system
shell 命令的简单 C 调用hello world
不起作用:
MWE:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main( int argc, char *argv[] )
{
char *str;
str = strdup ( "hello" );
printf ( "echo %s\n", str );
system ( ( "echo %s\n", str ) );
return 0;
}
输出:
回声你好
sh:1:你好:未找到