Jump to content
  • Advertisement
Sign in to follow this  
johnnyBravo

c++, whats that shell function again, run other apps using it?

This topic is 4839 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, a while ago I remember using a function i think was called shell to run other programs from my app, but I can't find it in any of my old source, so does anyone know what that function is called? thanks

Share this post


Link to post
Share on other sites
Advertisement
Hey I've got one little problem with the system function, when I put in a file with a space in its name, or in the path, it only reads to the space, and discards everything else.

There isn't any way around that is there?

Thanks

Share this post


Link to post
Share on other sites
system( "\"Path to a file with spaces in it\"" );

The system function just sends whatever argument you pass to the OS. You have to tell the Windows command line that the spaces in the path are not delimiters, that's why you have to put it inside quotes :)

Share this post


Link to post
Share on other sites
Quote:
Original post by johnnyBravo
Hey I've got one little problem with the system function, when I put in a file with a space in its name, or in the path, it only reads to the space, and discards everything else.

There isn't any way around that is there?


Quote it. E.g.:

system("C:\\Program Files\\Whatever\\I Like Pie.exe C:\\Documents and Settings\\Joe Smith\\A Document.doc");

becomes:

system("\"C:\\Program Files\\Whatever\\I Like Pie.exe\" \"C:\\Documents and Settings\\Joe Smith\\A Document.doc\"");

This is a limitation of the shell rather than system, AFAIK - it can't tell where the program name and each argument ends using telepathy, so it instead relies on spaces and grouping together quoted stuff.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!