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!
Printable View
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....