batch file - How to call the `dir` command by Visual C++ properly? -
i trying use command dir /s c:\ /b > temp.txt
in program. have tried in command line, , works, yet when try in program, program's files , folders.
i using visual c++ , command system("dir /s c:\ /b > temp.txt");
. know going wrong program, don't know what.
not clear you're asking actually, 1 thing know sure need escape backslash character in character array literal:
system("dir /s c:\\ /b > temp.txt"); // ^
alternatively provide raw string literal:
system(r"x(dir /s c:\ /b > temp.txt)x");
Comments
Post a Comment