This is how I am reading my text files in cmd. It is a constraint.
>gcc -std=c99 myproject.c -o myproject
>myproject<1.txt
What I'm trying to achieve is the file name "1.txt" as a string so that I can read the number for lines in the file. I looked through a bunch of solutions and all of them suggest argv[1] but when I do this:
int main(int args, char*argv[]) {
printf("File: %s\n", argv[1]); }
it prints null.
args gives 1 and argv[0] gives myproject. I don't know what else I could try. All I want to achieve the number of lines in the given input file. Please help. Thanks!