Mariusz Pekala
7/12/2007 12:00:00 PM
On 2007-07-12 08:15:04 +0900 (Thu, Jul), Richard Lawrence wrote:
> Doan, Alex wrote:
> >I'm using system call and pipping the output to a log. Something funny
> >happen when I have more then two escaped quotes and '>>' in my call. Can
> >someone shed some light on the issue:
> >
> >Case:
> >command_to_execute = "\"c:/program files/cvs.exe\" -q export -r HEAD -d
> >TEST \"1sks/src folder\" >> output.log"
> >system( command_to_execute )
> >
> >This call will error out stating that c:/program is not recognized.
>
> Isn't this because you need to escape the space, too? so that
> command_to_execute = "\"c:/program\ files/cvs.exe\" ..."
>
> >Now if I remove the >>, the command work fine.
> To me, that's the weird thing here...
>
Isn't it better to use the system() with multiple parameters in this
case?
as in: system('c:/program files/cvs.exe', '-q','export', ... )
Then you don't need to escape the special characters. I am not sure
whether this works on Windows.
I know, it might not allow redirecting ('>> output.log'), but I recall
DOS did not handle the redirections for the programs and the programs
themselves had to.
Maybe popen() would be acceptable solution?
--
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.