Hi,
I am receiving this error when I attempt to assign a value from argv[1] so I can use it as an int.
Here is the code:
int main(int argc, char** argv)
{
FILE* ifp;
int row;
/* Check the command line arguments */
if(argc != 4)
{
fprintf(stderr,"Not enough command line arguments!\n");
fprintf(stderr,"Use %s ROWS COLS OUTPUTFILE\n", argv[0]);
exit(-1);
}
ifp = fopen(argv[3], "r");
if(ifp == NULL)
{
fprintf(stderr,"File %s could not be opened!\n", argv[3]);
exit(-2);
}
row = argv[1];
return 0;
}
My command line arguments are: a.out (number) (number) (filename)
I want to use the numbers entered to create a 2d array, but I can't figure out how to use those numbers entered.
Any help is appreciated. Thank you