title: How to call the `dir` command by Visual C++ properly?
body: <p>I am trying to use the command <code>dir /s C:\ /b &gt; temp.txt</code> in my program. I have tried it in the command line, and it always works, yet when I try it in my program, I get my program's files and folders.</p>
  
  <p><a href="https://i.stack.imgur.com/Bx7E7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Bx7E7.png" alt="picture"></a></p>
  
  <p>I am using Visual C++ and the command <code>system("dir /s C:\ /b &gt; temp.txt");</code>. I know that something is going wrong with my program, but I don't know what.</p>