Originally posted by Hammer


>void add_record(void)
>FILE *dta_file;
>fprintf(dta_file,"%s\n",clientname);
See here... in function add_record() yuo have declared dta_file as a FILE * variable, then the first time it's used in the fprintf when you try and write to it. You need to open a file with dta_file first (fopen() calls like you have in main).

Also, this is wrong in your latest post:
Code:
dta_file = fopen("client.dat", "r+b"); //opening in binary mode for read/write 
    (dta_file == NULL);
The highlighted part doesn't do anything. You probably meant to say
>if (dta_file == NULL)

And this is wrong too:
>void main()
use int main(void), and given main() a return code.

And this is even wronger
>fflush(stdin);
dont do this, it's undefined behaviour.

And why do you fopen() a file, then fclose() it almost immediatetly?
I have tried to implement your suggestions and here is the code. No luck. I have no idea what's going on now. Thx for the help.