From: "Mariusz Pękala" Date: 2007-07-12T21:00:11+09:00 Subject: Re: Help with system() call and pipe --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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 =3D "\"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.=20 >=20 > Isn't this because you need to escape the space, too? so that > command_to_execute =3D "\"c:/program\ files/cvs.exe\" ..." >=20 > >Now if I remove the >>, the command work fine.=20 > To me, that's the weird thing here... >=20 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? --=20 No virus found in this outgoing message. Checked by 'grep -i virus $MESSAGE' Trust me. --CblX+4bnyfN0pR09 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7-ecc0.1.6 (GNU/Linux) iD8DBQFGlhfFsnU0scoWZKARAiy6AKDOANYb5fkSlo0M/9emTkgUKAkUagCg1+VL RNEIQGkLg9xQN/xPwY/w+lw= =NkR3 -----END PGP SIGNATURE----- --CblX+4bnyfN0pR09--