how would i use dos.h to call a system command like dir or copy or some other inferior command like that? OR were can i get a tutorial for using the dos.h header file?
how would i use dos.h to call a system command like dir or copy or some other inferior command like that? OR were can i get a tutorial for using the dos.h header file?
system(); is not defined in dos.h, but it IS defined in stdlib.h
i'll show u a quick example:
Code:#include <conio.h> // for getch() #include <stdlib.h> // for system() #include <iostream> // for cout using namespace std; int main(int argc, char *argv[]) { cout << "Press any key and watch in amazement as the contents of this directory apear on your screen!"; getch(); system("DIR"); getch(); return 0; }
"There are three kinds of people in the world...
Those that can count and those that can't."
i dont think this one is in dos.h but to do dos commands use
system("command");
it didn't work, but I have got the idea...[/B]Code:#include <conio.h> // for getch() #include <stdlib.h> // for system() #include <iostream> // for cout using namespace std; int main(int argc, char *argv[]) { cout << "Press any key and watch in amazement as the contents of this directory apear on your screen!"; getch(); system("DIR"); getch(); return 0; }
thanx
C++
The best
how would u do like if u typed ls into your program and then it ran dir.
You mean " ls" in LUNIX"
C++
The best
yes i am making a program for school that if u type in linux commands it does the DOS equivalent
>> it didn't work, but I have got the idea...
It didnt? what compiler are u using? It worked perfectly fine on mine (Visual C++ 6.0)
"There are three kinds of people in the world...
Those that can count and those that can't."
hey where could I find all the functions of this System things, I've looked all over the net and havent' been able to find it.
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
>> how would u do like if u typed ls into your program and then it ran dir.
>> hey where could I find all the functions of this System thingsCode:#include <conio.h> // for getch() #include <stdlib.h> // for system() #include <iostream> // for cout using namespace std; int main(int argc, char *argv[]) { char stringz[25]; cin >> stringz; if(strcmp(stringz, "ls") == 0) // strcmp return 0 if the pairs match { system("DIR"); } getch(); return 0; }
http://www.computerhope.com/msdos.htm
"There are three kinds of people in the world...
Those that can count and those that can't."
oh so you type any of those inside of system and it works cool thanks.
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
Oh I tried it, that's is so freaking cool, thanks I didn't know that.
There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!
"...The only real game I thank in the world is baseball..." --Babe Ruth
"Life is beautiful"-Don Corleone right before he died.
"The expert on anything was once a beginner" -Baseball poster I own.
Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.
>> Oh I tried it, that's is so freaking cool, thanks I didn't know that.
What is?
"There are three kinds of people in the world...
Those that can count and those that can't."
Could you please write the last program that you got with the last problems that you got so fare.
thanx
C++
The best
thank you thats awesome I learn sumthing every day.