Opening a folder whit cpp

When im opening a folder in cpp whit system("start C.....") i dont know how to write the path when some folder has space betwen words...
example

 
  system("start C:\\Users\\Nero\\Desktop\\cod4launchers\\Call of Duty(R)4 - Snip only ");

it cant find that path because the .exe name has space betwen words,..
so i need to write it without space,..example
 
 system("start C:\\Users\\Nero\\Desktop\\cod4launchers\\CallofDuty(R)4-Sniponly.exe ");


how i can opet that .exe whit space in his name,..i know how to opet program files but how to open another folders,..
Last edited on
closed account (Dy7SLyTq)
is the location right?
yes...but i can open only folders and files without space...i open program files whit this: progra~1...something like that...
1
2
3
4
5
6
7
#include <iostream>
int main(int argc, char **argv){
   for(int K=0; K<argc; ++K)
      std::cout << K << ": " << argv[K] << '\n';
   return 0;
}
$ ./a.out the quick "brown fox" jumps\ over 'the lazy dog'
0: ./a.out
1: the
2: quick
3: brown fox
4: jumps over
5: the lazy dog

escape especial characters
Last edited on
Explaining what ne555 said:
You should make sure that your string will be seen as one argument by start. Usual way to do this is put string in quotes (which you should escape as they are special characters: \"):
system("start \"C:\\Users\\Nero\\Desktop\\cod4launchers\\Call of Duty(R)4 - Snip only\"" );
Last edited on
i open program files whit this: progra~1...something like that...


Sounds like you are using a compiler [and possible integrated development environment (IDE)] that is so old that it only supports what are now called short file names (8.3 format). Get a newer compiler that supports long file names. What is your compiler name and version number? What is your operating system and version number?

Starting with Windows 95, Windows consumer line has supported long file names. I do not know where in the Windows NT, Windows 2000, etc. chain that long file names were added, but they were definitely supported in Windows 2000.
Last edited on
Topic archived. No new replies allowed.