Hi, i'm actually using a switch statement at the same time my codes are all working so far there is no problem.
But i wanted all my data i entered to be stored in a text file.
I have used this code, and it does not show me any error but, "is it really getting saved in a text file and how can i view it?"
Are the below codes correct? if not please help me, Thanks...
below are the codes shown, which i used to store my data into a text file...
/*codes for storing data in a textfile*/
ofp = fopen("myprogram.txt", "w");//creating a text file.//fprintf(ofp, "%d \n %f", i, f);
fprintf(ofp,"CLIENT REGISTRATION DETAILS\n\n");
Hi, tried...but i cant see my data saved onto the drive.
Is it possible to use those codes i posted in a switch statement...
i have posted them at the exact end before the return function, though it does not give me any error is it ok??
would you help me solve this since i have no error at the same time my data is not saved...
Your code doesn't show any closure for the file you created. That can cause a problem.
when your program is done writing data to the file. That will flush out any data that hasn't been written yet to the file, that is being held by a buffer.
My bet is that is your problem. Most hard drives are set up for buffered writing (for efficiency), and you haven't put much data into the file buffer, yet. Then you didn't close the file, so the data may not have been written out.