Hi. I'm having a problem with passing structures as function arguments. Pay particular attention to the definitions of the functions (lines 29 and 56). Upon compilation I always get these kinds of errors:
error: expected ‘)’ before ‘STRUCT_Users’
Where am I going wrong?
Code:main() { typedef struct { char OrigCurr[4]; char WantCurr[4]; float ExRate; } DATATYPE_Rates; typedef struct { char User[31]; char Pass[31]; char Role[14]; } DATATYPE_Users; DATATYPE_Rates STRUCT_Rates[100]; DATATYPE_Users STRUCT_Users[100]; int TXTDATA_Read_Rates(); int TXTDATA_Read_Users(); FILE *STREAM_Rates, *STREAM_Users; TXTDATA_Read_Rates(&STRUCT_Rates, &STREAM_Rates, &COUNT_Struct_Rates); TXTDATA_Read_Users(&STRUCT_Users, &STREAM_Users, &COUNT_Struct_Users); } int TXTDATA_Read_Rates(DATATYPE_Rates *a, FILE **STREAM_Rates, int *COUNT_Struct_Rates) { char FloatVal[99]; int i; *STREAM_Rates = fopen("rates.txt", "rt"); if (*STREAM_Rates == NULL) printf(" [Error!] \"rates.txt\" does not exist."); for (i = 0; !feof(*STREAM_Rates); i++) { fscanf(*STREAM_Rates, "%[^\t\n]\n", a[i].OrigCurr); fscanf(*STREAM_Rates, "%[^\t\n]\n", a[i].WantCurr); fscanf(*STREAM_Rates, "%[^\t\n]\n", FloatVal); a[i].ExRate = atof(FloatVal); } *COUNT_Struct_Rates = i; return *COUNT_Struct_Rates; } int TXTDATA_Read_Users(DATATYPE_Rates STRUCT_Users, FILE **STREAM_Users, int *COUNT_Struct_Users) { int i; *STREAM_Users = fopen("CA_users.txt", "rt"); if (*STREAM_Users == NULL) printf(" [Error!] \"CA_users.txt\" does not exist."); for (i = 0; !feof(*STREAM_Users); i++) { fscanf(*STREAM_Users, "%[^\t\n]\n", STRUCT_Users[i].User); fscanf(*STREAM_Users, "%[^\t\n]\n", STRUCT_Users[i].Pass); fscanf(*STREAM_Users, "%[^\t\n]\n", STRUCT_Users[i].Role); } *COUNT_Struct_Users = i; return *COUNT_Struct_Users; }



LinkBack URL
About LinkBacks




I used to be an adventurer like you... then I took an arrow to the knee.