Diffrent behaviour-VisualStudio Debugger against running exe
Diffrent behaviour-VisualStudio Debugger against running exe
ediT:我找到了差异的原因:只有在Visual Studio中才会打开输入文件(它们被添加到解决方案中,(更重要的是)放置在解决方案Windows目录中),所以它在那里工作。
但是当我尝试运行生成的 EXE 文件时,它不会读取这些文件,因为文件路径字符串(在 VS 中工作)"../文件名"
任何建议(因此在两种情况下都有效)?
在主代码中:
string testFileName = "LEGACY_R48_800BITS_@40MHz.dat"; //channel output file name
string bitsFileName = "sentBits4.dat"; //original sent bits file name,NO initial zero added
//Works in Visual Studio only
string path = __FILE__; //gets source code path, include file name
path = path.substr(0,1+path.find_last_of('')); //removes file name
path1= path+testFileName; //adds input file to path
path2=path+bitsFileName; //adds input file to path
//Works in Application EXE only
path1= testFileName;
path2=bitsFileName;
在
Visual Studio调试器中设置"工作目录"。
在"解决方案资源管理器"中选择项目后,在"项目"菜单上单击"属性"。单击调试选项卡。在 工作目录 字段中,输入将从中启动项目的目录。
相关文章:
- 为cl.exe(Visual Studio代码)指定命令行C++版本
- 终端不会为C++文件创建.exe文件吗
- 在Windows中以.exe的形式运行c++
- Visual Studio mkl_link_tool.exe链接错误
- PrintWindow函数在notepad.exe中出错
- VSCode C++ 编译的exe感染了Win32:TrojanX-gen[Trj]
- 将返回值从 exe 传递到 bat,并将其传递给 C# 中的进程
- 获取当前正在运行的 exe 名称(不是路径)
- 从 exe 文件 (Visual Studio ) 启动时调试断言失败
- 1d.exe找不到SFML文件?
- VI工作室代码错误无法打开输出文件主.exe
- 如何为每个客户生成自定义 exe
- 使用参数在 C# 的C++上运行.exe
- 在 ******.exe 中0x00000000772CA267 (ntdll.dll) 处未处理的异常:0xC0000
- 如何在Visual Studio Code中重命名我的a.exe文件?
- 解析引用 |exe/dll vs lib
- Q没有管理权限的 exe 无法启动维护工具
- 如何定义自定义生成配置类型,其中通常是.exe的目标改为 DLL
- running C++ exe from servlet
- Diffrent behaviour-VisualStudio Debugger against running exe