C Tutorial/File/File Read — различия между версиями
Admin (обсуждение | вклад) м (1 версия: Импорт контента...) |
(нет различий)
|
Текущая версия на 13:32, 25 мая 2010
Read string from a file
<source lang="cpp">#include<stdio.h> void main(){
FILE *fp; fp = fopen("test","a"); fprintf(fp,"%d %s %d\n",1,"1 a 1",2); fclose(fp) ; fp = fopen("test","r"); char rollno[10],name[10],marks[10]; fscanf(fp,"%d %s %d\n",&rollno,&name,&marks); printf(" %d %s %d\n",rollno,name,marks);
fclose(fp);
}</source>