Sorry, you need to enable JavaScript to visit this website.

Simple C programe writing values into a text file using FILE pointer

Unsolved
2 posts / 0 new
sekhar5505's picture
sekhar5505
Junior(0)
Simple C programe writing values into a text file using FILE pointer

Is there any rules to open a text file using FILE pointer???

I wrote one simple program and i printed helloworld and then i opened a one text file using FILE pointer and i wrote some values into that file but i can't see my text file in project.. can u tell me where it is stored in my project????

and as well as i saw printed results 50 times in my console i attached one simple c file check this... Is there any changes????

int main()
{

FILE *fp;

init_platform();

int a, b;

a = 20;
b = 10;

printf("\nHello World\n");

fp = fopen("hello.txt", "w");

for (i = 0; i < 10; i++)
{
fprintf (fp, "i = %d\n", i);
}

fclose(fp);

printf("\nFINISHED\n");

return 0;
}

TroutChaser's picture
TroutChaser
Moderator(18)
See answer to your other post