>fscanf(filename, "%d", t[i]);
>fscanf(filename, "%c", dump);
Don't forget that scanf expects a pointer. If your variable isn't already a pointer, you need to prefix it with the address-of operator:
fscanf(filename, "%d", &t[i]);
fscanf(filename, "%c", &dump);
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>strcpy(filename,argv[2]);
You haven't allocated any memory to filename. An uninitialized pointer is not the same thing as a pointer to infinite memory. You're better off just using an array instead of a pointer, especially in the case of a file name where you can figure out the maximum length of a valid path.
>tfPtr = fopen(filename,"rt");
I'm curious. Why not just use argv[2] instead of juggling with the filename pointer?
>#define SIZE 16
>char input[5000];
>fgets(input,SIZE,tfPtr);
That seems like kind of a waste to me. You give input 5000 characters but only utilize 15 of them for data.
>nt[i]=result[i];
result is NULL at this point; you'll likely get a segmentation fault.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401