使用system,shell,shellexcute打开文件. [英] opening a file using system, shell, shellexcute.

查看:87
本文介绍了使用system,shell,shellexcute打开文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于C ++,我在这方面还很陌生.在VB中,我使用Shell("explorer C:\ program files \")打开文件或文件夹.但是在Visual Studio C ++中.这似乎要困难得多.我尝试过

I''m fairly new at this, for C++ at-least. in VB i used Shell("explorer C:\program files\") to open a file or folder. But in Visual Studio C++. It seems to be much more difficult. I tried

Shell("C:\\Program File\\Test.exe); 



但是我找不到标识符. iv搜索了一下,有人提到添加#include< stdio.h>. (我认为那是正确的吗?).但是后来我遇到了200多个错误.所以有人可以帮助我以正确的方式做到这一点.在此先感谢.



But I get identifier cant be found. Iv searched around, and some people mentioned adding #include <stdio.h> ( I think thats the right one?) . But then I end up with like 200+ errors. So could somebody help me do this the correct way. Thanks in advance.

推荐答案

请参见函数ShellExecute: ^ ].

如您所见,此功能特定于Windows.有关可移植的代码,请参见功能system:
http://www.cplusplus.com/reference/clibrary/cstdlib/system/ [ ^ ].

另请参阅此讨论:
http://stackoverflow.com/questions/9303660/system-vs-shellexecute-differences [ ^ ].

—SA
Please see the function ShellExecute: http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx[^].

As you can see, this function is specific to Windows. For a portable code, see the function system:
http://www.cplusplus.com/reference/clibrary/cstdlib/system/[^].

See also this discussion:
http://stackoverflow.com/questions/9303660/system-vs-shellexecute-differences[^].

—SA


这篇关于使用system,shell,shellexcute打开文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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