-
lil tips
since this is a need help page... stuck on a little homework right now.. but just seeing if someone can maybe help me get past this not give me the answer. but in int main i have an Linker error undefined reference to 'print clock'; id returned 1 exit status.
Code:
int main(){
int i;
double minin,hrin;
double minout,hrout;
struct employee clock;
FILE* fp;
scanclock(clock);
printfclock(clock);
system("pause");
return 0;
}
void printclock(struct employee a){
int i;
double minin,hrin;
double minout,hrout;
FILE* fp;
fp = fopen("clock.txt", "r");
fprintf(fp, "%s %s %lf %lf %lf %lf", a.first, a.last, minin, hrin, minout, hrout);
fclose(fp);
}
That is what i have.. its not the whole code but just where i think the error is coming from. Please and thank you!... like i said im just looking for some aid not the exact answer.
-
Check your spellings carefully. You are not calling printclock(), but printfclock(), which does not exist.
-
Remember that C processes a file from top down. Any function or variable must be defined before it can be used. Does your program do this. Where is your function defined, before or after your function call?
Jim
-
yes it was spelled wrong... its located above int main
when I compile it shouldn't the information from the file be on the output? cause right its just showing the system("pause") function
-
It should be in the file, not on the console.
Jim
-
so when i am printing, i am printing to the file? therefor i should have fp= fopen("clock.txt", "w"); instead of "r"?
-
Yes if you want to write to a file you should use a open mode that allows writing, a, a+, r+, w, w+.
Jim
-
For some reason throwing files into the structs and with functions is jamming me from being able to completely think this program through but thanks for the help im gonna try working the rest out think you have me down the right path.