开发者

System() function in C showing buggy output

开发者 https://www.devze.com 2023-02-21 17:30 出处:网络
I am using the system() functi开发者_运维问答on in C to run a system command. While using the system(), the command I am using is:

I am using the system() functi开发者_运维问答on in C to run a system command. While using the system(), the command I am using is:

system("C:\splint-3.1.2\bin\splint first.c>output.txt");

However, the output of this is not being correctly sent to the txt file. To be more specific, the txt file is created, however the output is not appended to the file.

On running the same command from the CMD, the output is correctly sent to the txt file.

Any idea on what's going wrong?


Escape your backslashes so the compiler interprets them correctly:

system("C:\\splint-3.1.2\\bin\\splint first.c>output.txt");
0

精彩评论

暂无评论...
验证码 换一张
取 消