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.

picture

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

Popular posts from this blog

java - nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet Hibernate+SpringMVC -

sql - Postgresql tables exists, but getting "relation does not exist" when querying -

asp.net mvc - breakpoint on javascript in CSHTML? -