simple read and write program
here's my simple code..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
#include <stdio.h>
#include <conio.h>
int main ()
{
clrscr();
FILE * pFile;
char name [100], address [100];
pFile = fopen ("myfile.txt","w");
puts ("enter a name: ");
gets (name);
puts ("\naddress: ");
gets (address);
fprintf (pFile, "Name:%10.50s\n",name);
fprintf (pFile, "Address:%10.50s\n",address);
fclose (pFile);
return 0;
getch();
}
|
how can i read/get the data and print it?
anyone kindly help me with the code on how to read the data or call the myfile.txt file.
hope it is simple because i am a beginner.
reply as soon as posible..
thanks a lot..
Topic archived. No new replies allowed.