Click to See Complete Forum and Search --> : command line in C++


[Mystik_Cool]
09-30-2001, 03:42 PM
Someone told me that we just have to include the "stdlib.h" in the source code, then to write smthing as :

main()
{
system("ls");
}

and to compile, and it was working. I think this person forgot smthing, 'cause when I want to compile I get a horrible error-answer ! lol

Anyone know how to (simply :D ) include a command line (as you could type in the shell) in a C++ prog ?

Strike
09-30-2001, 03:45 PM
that person was right, that's all you need to do - what error do you get?

Gnu/Vince
09-30-2001, 04:18 PM
#include <stdlib.h>

int main()
{
system("ls");
return 0;
}