Jump to content
  • Advertisement
Sign in to follow this  
Jareds411

Spaces in a file path

This topic is 4970 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

I have a line of code as such: system("edit C:\\My Documents\\test.txt"); The problem is, it doesn't see the space. How do I get it to use the space between My and Documents?

Share this post


Link to post
Share on other sites
Advertisement
well, normally at the command line you could wrap the entire path in quotes, but since you're already inside a string literal, try

system("edit \"C:\\My Documents\\test.txt\"");

if that doesn't work, try escaping the space with '\ ' (not sure if that will work, either)

It's been a long time since I've seen a DOS or Win32 box and/or made system calls on it, but I'm pretty sure the first solution I suggested should work.

Share this post


Link to post
Share on other sites
DOS has a 8.3 limit on name lengths, so I think something like "C:\MY DOC~1\TEST.TXT" should work (cant quite remember though). This is because DOS truncates longer dir names to an 8 charater length (the .3 is for file extensions) and adds ~1 (or ~2, ~3 if theres more than one with the same first 6 characters).

Hope that helps, sorry if it doesnt (or is a load of BS).

Share this post


Link to post
Share on other sites
Quote:
Original post by grekster
DOS has a 8.3 limit on name lengths, so I think something like "C:\MY DOC~1\TEST.TXT" should work (cant quite remember though). This is because DOS truncates longer dir names to an 8 charater length (the .3 is for file extensions) and adds ~1 (or ~2, ~3 if theres more than one with the same first 6 characters).

Hope that helps, sorry if it doesnt (or is a load of BS).


it's all good stuff. the older versions of dos limited file and folder names to 8 chars and no spaces.

so

c:\my documents
could be accessed as
c:\mydocu~1


...oh the nostalgia

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!