- English
- فارسی
30-4
#include<stdio.h> #include<string.h> void main () { char matn[1024]; char str[80]; int i=23456; double A[200]; FILE *f; f = fopen ("test.txt", "r"); if (!f) { // f==NULL printf("Cannot open test.txt for writing.\n"); return; } while (!feof(f)) { //fscanf(f, "%s", str); char *readOK = fgets(str, 79, f); if (readOK == NULL) break; if (str [ strlen(str)-1 ] == '\n') str [ strlen(str)-1 ] = 0; printf("%s\n", str); } //while (!feof(f)) { // fscanf(f, "%d", &i); // printf("%d\n", i); //} fclose(f); }