[英]Why would a program run when launch from windows but not the command prompt?
I wrote a small C++ program in VS2k8. 我在VS2k8中编写了一个小型C ++程序。 When I launch it from windows (double click the exe file) it runs fine.
当我从Windows启动它(双击exe文件)时,它运行良好。 When I go to the command prompt and try to run it it will hang and eventually crash.
当我转到命令提示符并尝试运行它时,它将挂起并最终崩溃。 I've created test programs with simple outputs that work fine both ways.
我创建了具有简单输出的测试程序,这些输出在两种情况下均能正常工作。
Is there something I'm missing? 有什么我想念的吗? I'm relatively new to programming.
我是编程新手。 I'm trying to launch this program using the VBA shell command but it produces the same outcome as the command prompt.
我正在尝试使用VBA shell命令启动该程序,但其产生的结果与命令提示符相同。
The funny thing is it was working fine at first until I went in to change the value of a constant variable and rebuilt it (I didn't think that had anything to do with it but I changed it back with no success). 有趣的是,在我开始更改常量变量的值并重建它之前,它一直运行良好(我认为这与它没有任何关系,但是我改回了没有成功)。 No settings where changed.
没有更改的设置。
Edit: I've name it time.exe and than copies.exe (when I tried copying and pasting the code into a new project). 编辑:我将其命名为time.exe,而不是copys.exe(当我尝试将代码复制并粘贴到新项目中时)。 The actual code is about 250 lines, not sure what part of it would be causing the issue.
实际的代码大约为250行,不确定其中的哪一部分会引起问题。 It opens a .csv file, loads the information into vectors, and then compares the vectors to each other (adding something to the end of it if it meets certain conditions).
它打开一个.csv文件,将信息加载到向量中,然后将向量彼此进行比较(如果满足某些条件,则在其末尾添加一些内容)。 It than outputs the file to another .csv file.
然后将文件输出到另一个.csv文件。
可能建议启动时的当前目录不同,这在您对当前路径或驱动器做出一些假设时引起了您的问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.