如何在调用fc命令后获取退出代码? [英] How to get the exit code after invoking fc command?

查看:84
本文介绍了如何在调用fc命令后获取退出代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用VIsual C ++ 2008,我使用:: CreateProcess函数从命令行调用fc命令,比较两个文件。


命令行是"fc / b a.dat b.dat"。


现在我想获取fc的退出代码,这样我才能知道这两个文件是否相同。怎么做?


谢谢

解决方案

考虑 GetExitCodeProcess 。通过
PROCESS_INFORMATION 参数使用 CreateProcess 返回的句柄。


但首先等待使用 WaitForSingleObject终止进程


Hi,

I am using VIsual C++ 2008 and I use ::CreateProcess function to invoke fc command from commandline, to compare two files.

The commandline is "fc/b a.dat b.dat'.

Now I want to obtain the exit code of fc so that I can know whether the two files are identical or not. How to do so?

Thanks

解决方案

Consider GetExitCodeProcess. Use the handle returned by CreateProcess via PROCESS_INFORMATION argument.

But firstly wait for process termination using WaitForSingleObject.


这篇关于如何在调用fc命令后获取退出代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆