Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void read_from_file (char file_name[])
  2. {
  3. FILE *f;
  4. printf("Reading from the file %s :\n\r",file_name);
  5. f = fopen (file_name, "rt");
  6. if (f == NULL)
  7. {
  8. printf ("Can't open the file %s ", file_name);
  9. exit(1);
  10. }
  11. else
  12. {
  13. printf("The file %s has been opened \n\r", file_name);
  14. for (fscanf(f,"%c", &c); !feof (f); fscanf (f,"%c", &c))
  15. fprintf (stdout, "%c", c);///?fscanf למה לא
  16. if (fclose(f))
  17. exit (1); //the closing wasnt sucssesful
  18. else
  19. printf ("\n\rThe file %s has been closed", file_name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement