Hi,
I have a liitle program the stores information in arrays.
I have it to work fine and display the information but I am trying to make it write the information to a text file as well.
The code i have...
Code:
void CreateATextFile(void)
{
/* local variable definition */
int i = 0;
/* Open the customer file...If it doesn't exist create it... */
FILE *RecordFile;
RecordFile = fopen("RecordFile.txt", "a++");
/* Send data for each structure to the file */
for(i = 0; i < c; i++)
{
fprintf(RecordFile,"Customer Record: = %d\n", i);
fprintf(RecordFile,"\tName:\t%s\n", customer[i].Name);
fprintf(RecordFile,"\tAge:\t%d\n", customer[i].Age);
fprintf(RecordFile,"Policy\n");
fprintf(RecordFile,"\tType:\t%s\n", customer[i].Policy);
fprintf(RecordFile,"\tPremium:%c%d\n", 163, customer[i].Premium);
fprintf(RecordFile,"\tExcess:\t%c%d\n\n", 163, customer[i].Excess);
}
fprintf(RecordFile,"*************************************\n\n");
fclose(RecordFile);
} /* End of create a text file */
Everything seems to work fine but it does not enter the information just the line of *'s. I cant see a problem and the are no error's or warning when I compile.
Any help would be great.
Thanks
Andy