Boost logo

Boost :

From: Eric Boutin (eric_at_[hidden])
Date: 2003-12-09 20:08:52


Hi ! If you didn't knew already, under windows, I didn't tested all
compiler, but vc++ 6.0 have this issue, well system(const char*) is buggy:
you have to double-quote the command to execute.

Example
instead of
string callstring = " \"c:\\Program File\\a program\\a executable.exe\"
\"--a argument\"";
system(callstring.c_str() );
( cout << callstring would produce : "c:\Program File\a program\a
executable.exe" "--a argument" )

you have to do
string callstring(" \"\"c:\\Program File\\a program\\a executable.exe\"
\"--a argument\""\");
system(callstring.c_str() );
(cout << callstring would produce : " "c:\Program File\a program\a
executable.exe" "--a argument" ")

i.e. you have to produce:
" "a file containing whitespace" "-a argument" "

I didn't tested this issue under all os, since microsoft are the only one
who had the idea to put whitespace in filename

therefore, it would be nice to have a macro BOOST_BUGGY_SYSTEM to know if we
have to double-quote the system( ) calls

for now it would be only
#ifdef WIN32
#define BOOST_BUGGY_SYSTEM
#endif

but additionnal testing would be required

thanks for your time


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk