Sample C Programs


  1. filereader.c
    -- Reads integers from a file, fscanf()
  2. filereader2.c
    -- Reads strings (separated by whitespace) from a file, fscanf()
  3. filereader3.c
    -- Reads lines of strings from a file, fgets()
  4. filereader4.c
    -- Reads characters from a file, fgetc()
  5. filereader5.c
    -- Reads characters from a file, fgetc(), also puts a character back into the file, ungetc()
  6. filereader6.c
    -- Reads integers from a file and stores them in an array
    -- This array is statically allocated - int num[1000];
  7. filereader7.c
    -- Reads integers from a file and stores them in an array
    -- This array is dynamically allocated - int *num and use malloc() for memory allocation