Blah nevermind the crap about sscanf and sprintf, never even seen these functions yet in my studies. I will read up on them. :)
Type: Posts; User: Chris5
Blah nevermind the crap about sscanf and sprintf, never even seen these functions yet in my studies. I will read up on them. :)
Are you saying to use all three ( fgets(), sscanf() and sprintf() ) to pass those fields into the arrays? For example using fgets for the string, name[i]? And sscanf() for the int and doubles?
...
Nvm, even placing the %s at the end didn't fix my problem.
EDIT: Would arranging the order of variables in the function itself and the call of the function in main make any difference?
...
00101010,80.0,79.0,88.0,67.0,90.0,Bob Newhart
00111010,88.0,77.0,66.0,57.0,56.0,Alex Trebek
00121010,80.0,79.0,88.0,67.0,90.0,Stephen Harper
00131010,88.0,77.0,66.0,57.0,56.0,Alfred Newman...
#include<stdio.h>
/* Loads data from file into arrays */
void loadData(int stu[],char name[][20],double t1[],double t2[], double a[], double labs[], double exams[])
{
...
Fixed both of those, still receiving 'segmentation fault'.
I fixed the specified errors, but I'm still getting segmentation fault :S
I haven't been using files for very long, not sure if im using the correct functions here, but I keep getting 'segmentation fault', and I'm not sure where my problem might be.
...