Even if I try to google it, the terms in the question are not correct, so I'm asking you because only information that is different from the information I want to find.
After coding from putty to c language, I would like to know how to execute it by putting the name of the txt file instead of specifying the file name with
fopen in advance when executing the code using the txt file. For example,
./test.c input.txt I want to run it like this, but I can't find a way.
The test.c is a source file and cannot be run like
After you create an executable by compiling the test.c file with a compiler such as gcc, you must run the executable file.
Compiling as above creates an executable file named test.
You can then run the executable file as shown below.
And if you want to do something like
./test input.txt, you need to write a program accordingly by passing the string input.txt inside the program through "command line argument"
Search Google or Naver for C language command line arguments or command line arguments to check how to use them.
© 2022 pinfo. All rights reserved.