sending parameters to a batch file

ok so im trying to send the parameters "app" "version" and "file" to my batch file that will copy file from the app/version folder on the network, but i cant seem to pass the prams correctly can some one help me

i tried this
system("xfer.bat app version file");
but i just end up opening the batch file and passing the words app version and file not the values collected before hand
Last edited on
What are the values collected beforehand stored in?
looks like you're missing the point of the system() function.
this function sends a c-string to the creating process to be evaluated.

try this instead:


1
2
3
std::string s;
s = std::string("xfer.bat ") + app + std::string(" ") + version + std::string(" ") + file;
system( s.c_str() );


this method assumes that app, version and file are string objects.
ok ill try that and the app version and file are just local variable strings
that worked perfect thanks!
Topic archived. No new replies allowed.