I'm trying to fix an existing C-program with VS2005 that eventually calls
int system(command) //in C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\system.c)
with parameter value
start C:\Program Files\VideoLAN\VLC\vlc.exe C:\Documents and Settings\me\My Documents\My Music\09 - Track09.mp3
the program to be started and the filename paths are both formed from env variables that are got and the command start is appended to start of char buffer. The env variables are:
%VLCPATH%
which has valueC:\Program Files\VideoLAN\VLC
%MUSIC%
which has valueC:\Documents and Settings\me\My Documents\My Music
I've been trying this with XP Command Prompt and everything works fine when paths don't have spaces. Also this works:
"%VLCPATH%\vlc.exe" "%MUSIC%\09 - Track09.mp3"
So what should I do?
- edit env variables to have quotes? (Don't think so)
- check if command has file as parameter and then somehow add quotes with escape character to maybe both of them and remove the word start?
- do something sensible / elegant that I'm not aware of