M
Magix
Hi,
I would like to replace title string into a file. My output file looks like
this:
Name Age Address
==== === ======
Ken 23 New York City
Rebecca 25 Toronto
The data list will be appended. But I only want the title string appear once
at the top only:
Name Age Address
==== === ======
I think each time I append the data, i will replace the same string title
for the 1st and 2 nd line. or you have better idea ?
FILE *fptr;
char fileName[40];
// open file.
if ((fptr = fopen("text.txt", "aw"))== NULL)
{
printf("Error: Couldn't create file.\n");
exit(1);
}
// replace the 1st and 2nd line string title each time append.
// append into file
fprintf(fptr, "%s %s %s ", name, age, address );
fprintf(fptr, "\r\n");
fclose(fptr);
Thanks.
Dimension.
I would like to replace title string into a file. My output file looks like
this:
Name Age Address
==== === ======
Ken 23 New York City
Rebecca 25 Toronto
The data list will be appended. But I only want the title string appear once
at the top only:
Name Age Address
==== === ======
I think each time I append the data, i will replace the same string title
for the 1st and 2 nd line. or you have better idea ?
FILE *fptr;
char fileName[40];
// open file.
if ((fptr = fopen("text.txt", "aw"))== NULL)
{
printf("Error: Couldn't create file.\n");
exit(1);
}
// replace the 1st and 2nd line string title each time append.
// append into file
fprintf(fptr, "%s %s %s ", name, age, address );
fprintf(fptr, "\r\n");
fclose(fptr);
Thanks.
Dimension.