Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make my program run other programs

Status
Not open for further replies.

The1337scripter

Programmer
Jun 15, 2006
1
CA
ok, well, its pretty basic, what would I put in my script because when they logg in its gonna prompt my program *Its a login mangement program* anyways, im almost complete it.

if (retry=="log") {
cout << "Logging off\n";

ifstream a_file ( "logoff.bat" );
}


is what I have, how do I make it so when they type log in the cmd prompt, itll run the logoff.bat program so it logs out of the account. I can't find any good tutorials on it. Please help me =(
 
try

if (retry=="log") {
cout << "Logging off\n";

_execl("logoff.bat","logoff.bat",NULL);
}

you'll have to include process.h.


john.
 
I think the exec functions will transfer control to the new process permanently. By what I read on MSDN, the spawn functions create a new process but also keep running the current one (if that's what you want).
Of course there's also good old system().
Code:
system( "logoff.bat" );
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top