i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth
(10-15-2009, 01:58 PM)SylverTech Wrote: [ -> ]i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth
what I know is that you can use system("any_dos_command_here"), try and see if it works for you, but you have to include cstdlib.h
is this anything google cant answer? i know people are scared of Google but this is ridiculous
Did someone else post this, some whos account was closed? Is this the same person?
(10-15-2009, 01:58 PM)SylverTech Wrote: [ -> ]i started learning c++ 2 months ago but i still haven't figured out how to do the MSDOS commands from c++ (i know the "call" command)
like for example changing the password of the current user and so forth
What I think your trying to do is use window's commands from command prompt?
Try using the
command. An example would be an MS ping command.
Code:
#include <iostream>
using namespace std;
int main()
{
cout << "This is a ping test.";
system("ping www.google.com");
return 0;
}
Hope this helps!
-Trinity
that's what I told him ^^
the thing with the system command is every time you run a new system () call it creates a new shell, so doing something like
Code:
int main ()
{
system ("cd /D C:\\");
system ("cd");
system ("pause >nul");
}
instead of printing out C:\ for the second system call it would still print the working directory of the program.
Oh yeah you're right, but is there any alternative ??
Call a batch file from C++, that should allow you to run multiple commands in the same shell.