Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
system()使用C++;[许可问题] 我是C++程序员的初学者,对StAcppFux_C++_Windows - Fatal编程技术网

system()使用C++;[许可问题] 我是C++程序员的初学者,对StAcppFux

system()使用C++;[许可问题] 我是C++程序员的初学者,对StAcppFux,c++,windows,C++,Windows,我正在尝试使用system()调用程序中的.exe,以便使用以下命令将RTF转换为纯文本: system("converter.exe convert doc.doc > doc.txt") 根据我对system()==>system(“program.exe arg1”)的理解。 当我编译这段代码时,它会显示converter.exe,但它不会给我输出(.txt)。 我得出的结论是VisualStudio2010使用非管理CMD打开此.exe,其中程序只会弹出1秒并消失(执行前我还需要

我正在尝试使用
system()
调用程序中的.exe,以便使用以下命令将RTF转换为纯文本:

system("converter.exe convert doc.doc > doc.txt")
根据我对
system()
==>
system(“program.exe arg1”)
的理解。 当我编译这段代码时,它会显示converter.exe,但它不会给我输出(.txt)。 我得出的结论是VisualStudio2010使用非管理CMD打开此.exe,其中程序只会弹出1秒并消失(执行前我还需要按“ok”)

有关于如何在管理员许可下运行
system()
的建议吗


PS:我试着在.exe上更改“运行为管理员”,但是系统似乎不允许我改变任何东西。

< P>如果您确实需要管理员权限,请考虑使用:

系统(“runas/user:foo\”converter.exe convert doc.doc>doc.txt\”)


用户访问控制不是这样工作的。它启动流程失败或成功。它不会给你一秒钟。很可能进程的当前目录不是您所认为的。可能当前目录没有授予您在其中写入
doc.txt
的权限。1.为什么您需要管理员权限才能进行文本转换?听起来不对。2.从控制台启动程序,而不是从VS,然后看看会发生什么。3.尝试给出完整路径,而不是仅仅给出“doc.txt”。可能是
system()
时的当前目录不是您所期望的,并且文件只是在某个您不查找的地方结束。谢谢大家,收到了!真的很感激