Quote Originally Posted by ArakelTheDragon View Post
Hi guys, maybe I am overworking myself, I think its something simple. I need to record the output of a CMD command to a file.
How can this even compile, even if your compiler allows the use of gets(), that was removed from the C11 standard? I have to assume you have not attempted to compile this code!

"Infile" seems to be an output file, not an INput file, as it is opened in write mode.

Where do you open the "CommandOutput" file or command using _popen()?

You need to compile your program first, fixing all the warning and errors BEFORE asking for help, or at least ask specific questions about why it will not compile. We can't even try to compile and test this program.

This code is not even close to the point where you should ask for help.

Turn on your warning level, and turn up the warning level to the highest level. Not sure what compiler you are using under Windows.

If using a Microsoft compiler and not mingw64 or cygwin, then _popen() is the function to use under a Microsoft compiler. I can't speak for mingw64 or cygwin, or an other Windows compiler.