include <stdio.h>
      #include <stdlib.h> // For exit() function
      int main() {
          char c[1000];
          FILE *fptr;
          if ((fptr = fopen("program.txt", "r")) == NULL) {
              printf("Error! File cannot be opened.");
              // Program exits if the file pointer returns NULL.
              exit(1);
          }
          // reads text until newline is encountered
          fscanf(fptr, "%[^\n]", c);
          printf("Data from the file:\n%s", c);
          fclose(fptr);
          return 0;
      }
      
      Apex language logo

      Read fie

      0

      0

      avatar
      natalie19970

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.