i want to write data to a file

February 23, 2010 at 05:20:33
Specs: Windows XP
i have attached the code i have written below

void printfile(int i)
{
FILE* write;
write = fopen("write.txt", "a+");
fprintf(write, "%i \n", i);
}
int main()
{
>
int i;
for (i = 0; i < 10 ; i++)
{
printfile(i);
}
return 0;
}


See More: i want to write data to a file

Report •


#1
February 27, 2010 at 05:58:06
you aren't closing the file in your printfile routine. If you did, it
would work better.

Report •
Related Solutions


Ask Question