📜  c 从命令行读取文件 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:36.829000             🧑  作者: Mango

代码示例2
You can use as your main function:
int main(int argc, char **argv) 

So, if you entered to run your program:
C:\myprogram myfile.txt

argc will be 2
argv[0] will be myprogram
argv[1] will be myfile.txt

To read the file:
FILE *f = fopen(argv[1], "r");