gpt4 book ai didi

c++ - 如何在 DevC++ 中运行程序并在文件路径中使用空格?

转载 作者:行者123 更新时间:2023-11-30 05:36:50 27 4
gpt4 key购买 nike

我正在尝试使用 Dev-C++,但它无法正常工作,因为我无法在文件路径中运行带有空格的程序。看起来有人忘记了经常使用这样的字符。

我可以毫无问题地编译代码,但我无法运行它。

--------------------------------
Failed to execute "C:\Users\Crezary Wagner\Desktop\c++\multi.exe":
Error 193: %1 is not a valid Win32 application.

程序有效,但“Crezary Wagner”中有空间,现代 IDE 存在问题 :) 如何修复?

最佳答案

如果您将此路径作为字符串参数提供,您可以附加 \"

字符到字符串的起点和终点:

program2runStr = "\"" + program2runStr + "\"";

关于c++ - 如何在 DevC++ 中运行程序并在文件路径中使用空格?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33430599/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com