problems with opening files due to file's path

A

Alexnb

Okay, so what I want my program to do it open a file, a music file in
specific, and for this we will say it is an .mp3. Well, I am using the
system() command from the os class. The problem I am running into is that
when I send the path of the file to the system() command, which for those of
you who don't know the system command is the equivalent of typing one
command into command prompt or terminal depending on your system. But let's
say that the file is "C:\Music\01 - Track.mp3" or something like that where
the number 0 is next to the backslash. Another example is this
"C:\Music\track(single)\Track.mp3" The problem here is that the ")" at the
end of the single, is conflicting with the backslash as well. Now here is
the exact code I was trying to do and when I run it I get false returned.

system("\"C:\Documents and Settings\Alex\My Documents\My
Music\Rhapsody\Bryanbros\Weezer\(2001)\04 - Island In The Sun.wma\"")

Okay, now as you can see it sends it to the system with quotes "\"" and
works if I change the file path and get rid of the "04" and the ")" it
works, so that is the problem no doubt. If anyone has a way to do this
please let me know, or even another way to open a music file like this.
Help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top