I'm trying to use that DOS command to output a dir result to a text file. Is there any way to execute the command through in my C++ program?
If not, is there a way in C++ to get a list of all files in a directory?
Thanks!
This is a discussion on Execute DOS Commands in C++? within the C++ Programming forums, part of the General Programming Boards category; I'm trying to use that DOS command to output a dir result to a text file. Is there any way ...
I'm trying to use that DOS command to output a dir result to a text file. Is there any way to execute the command through in my C++ program?
If not, is there a way in C++ to get a list of all files in a directory?
Thanks!
Yes, there is:
Code:#include <stdlib.h> int main (int argc, char* argv[]) { system("dir C:\\temp > C:\\temp\\out.txt"); return 0; }
Great, thanks!
i thouhgt u need to include dos.h ? even tho it wouldnt make sense....
Email: Klinerr1@nc.rr.com || AIM: MisterSako || MSN: sakotheinsane@hotmail.com
-the shroom has spoken