Reputation: 1
If I have a path(string) with spaces, for example "C:\\Users\\Irina\\Desktop\\POO\\PROIECT POO\\my file.docx"
and I want to open that file, I use the system command like this
system(path.c_str())
And I get the following error :
'C:\Users\Irina\Desktop\POO\PROIECT' is not recognized as an internal or external command, operable program or batch file.
I would really appreciate some help. Thanks :)
Upvotes: 0
Views: 722
Reputation: 29017
You need to enclose the string in double quotes:
system(('"' + path + '"').c_str());
Upvotes: 1