J
Jonathan Shan
Hello everybody,
For some strange reason my output to file keeps writing to the top
instead of bottom.
Here is the code that exhibits the problem:
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;
}
The output is:
9
8
7
....
instead of the "expected"
0
1
2
....
I already realize one solution is to reverse the for loop..
Jonathan Shan
For some strange reason my output to file keeps writing to the top
instead of bottom.
Here is the code that exhibits the problem:
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;
}
The output is:
9
8
7
....
instead of the "expected"
0
1
2
....
I already realize one solution is to reverse the for loop..
Jonathan Shan