Guest_imported
New member
- Jan 1, 1970
- 0
Hi there,
I am writing this program for a uni assignment and i need a function to display some student details in a file.
i have opened the file at the start of the program
FILE *fpout;
fpout = fopen("c:\\sp3work\\proj2out.dat","w"
if (fpout == NULL)
printf("error opening file %p\n",fpout)
and then i can display the values it picks up with
fprintf(fpout,"\n\n %-5d %7s %14s %17c%8c %9.2f %12.2f",id_num,given_name,family_name,course_code,shift_code,balance,fee_paid);
But how do i make this same line in a function...i have trouble passing the value of fpout. I have tried passing the pointer value.... in the function def *fpout then in the call &fpout . It is giving me the error 'Cannot convert 'std::FILE *' to 'std::FILE''
I dont want to reopen the file in the function as i cannot let the file pointer be reset as i need it to keep reading the 100 lines of data..
hope this is enough info for some help which would be greatly appreciated..
thanks dave.
I am writing this program for a uni assignment and i need a function to display some student details in a file.
i have opened the file at the start of the program
FILE *fpout;
fpout = fopen("c:\\sp3work\\proj2out.dat","w"
if (fpout == NULL)
printf("error opening file %p\n",fpout)
and then i can display the values it picks up with
fprintf(fpout,"\n\n %-5d %7s %14s %17c%8c %9.2f %12.2f",id_num,given_name,family_name,course_code,shift_code,balance,fee_paid);
But how do i make this same line in a function...i have trouble passing the value of fpout. I have tried passing the pointer value.... in the function def *fpout then in the call &fpout . It is giving me the error 'Cannot convert 'std::FILE *' to 'std::FILE''
I dont want to reopen the file in the function as i cannot let the file pointer be reset as i need it to keep reading the 100 lines of data..
hope this is enough info for some help which would be greatly appreciated..
thanks dave.