Previously, when I mentioned saving the running result to a file, I naturally thought of the method of reading the file in C language. However, this is difficult for beginners.
">
Yesterday afternoon, the teacher taught us a trick. After the C language program is compiled, We will compile it into a. object file, and then link it to generate the. exe executable file. However, we generally run this program directly in the compiling environment. Of course, we can also run executable files in the form of command lines (I think everyone knows this ).
The following describes how to save the running result in a file.
This figure shows the method. Sorted. EXE is my executable file. "> Out.txt indicates that the execution result is stored in the out.txt file under the current directory. ">" Means to overwrite or overwrite the object, and ">" means to append the object.