Try
system("start /m /b htbasic.exe");
Main Topics
Browse All TopicsHow can i pass arguments to a command using system("command" args); ?
For example system(start /m /b htbasic.exe);
Where start is a Dos command and /m, /b , htbasic.exe it's arguments.
I simply tried the option above and system("start" /m /b htbasic.exe);
Didn't word ...
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
OK. Testing with a fixed string, however i want to do it,
with the program name (for ex. htbasic.exe) and this name would be the contents of a variable and the line system ( ....) need to do a variable substitution.
For example:
std::string program_name = "htbasic.exe";
system("start /m /b" program_name);
The problem is that using quotes in the program_name this will prevent the variable substitution.
Due to i'm new using C and C++ i don't know how to do it in these languages, for ex. in Tcl i use often use this kind of statement using catch and exec.
OK. Testing with a fixed string, however i want to do it,
with the program name (for ex. htbasic.exe) and this name would be the contents of a variable and the line system ( ....) need to do a variable substitution.
For example:
std::string program_name = "htbasic.exe";
system("start /m /b" program_name);
The problem is that using quotes in the program_name this will prevent the variable substitution.
Due to i'm new using C and C++ i don't know how to do it in these languages, for ex. in Tcl i use often use this kind of statement using catch and exec.
You need to add the strings together before using the system function.
For example:
std::string program_name = "start htbasic.exe";
std::string MoreStuff = " /m /b";
std::string CompleteArgument = program_name + MoreStuff;
system(CompleteArgument.c_
Don't forget to use the .c_str() function when passing a std::string object to the system() function.
OK. Testing with a fixed string, however i want to do it,
with the program name (for ex. htbasic.exe) and this name would be the contents of a variable and the line system ( ....) need to do a variable substitution.
For example:
std::string program_name = "htbasic.exe";
system("start /m /b" program_name);
The problem is that using quotes in the program_name this will prevent the variable substitution.
Due to i'm new using C and C++ i don't know how to do it in these languages, for ex. in Tcl i use often use this kind of statement using catch and exec.
OK. Testing with a fixed string, however i want to do it,
with the program name (for ex. htbasic.exe) and this name would be the contents of a variable and the line system ( ....) need to do a variable substitution.
For example:
std::string program_name = "htbasic.exe";
system("start /m /b" program_name);
The problem is that using quotes in the program_name this will prevent the variable substitution.
Due to i'm new using C and C++ i don't know how to do it in these languages, for ex. in Tcl i use often use this kind of statement using catch and exec.
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days. Unless there is objection or further activity, I will suggest to accept "Axter" comment(s) as an answer.
If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchang
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
======
Werner
Uuuh,
Comment
From: Axter Date: 10/31/2001 09:32PM PST
You need to add the strings together before using the system function.
Comment
From: jkr Date: 10/31/2001 06:00AM PST
Well, in this case, create a function to do this:
int Start ( std::string& program_name) {
std::string start_and_opts = "start /m /b ";
std::string command = start_and_opts + program_name;
return ( system ( command.c_str());
}
I think I was a _little_ earlier :o)
Business Accounts
Answer for Membership
by: clebanoPosted on 2001-10-30 at 16:25:15ID: 6602922
update