Version Info

Help About Web Editors Home
Online VI Editor
Online Emacs Editor
Command Line Arguments: STDIN Input:
Multiple Files
#include <stdio.h>
#include <string.h>

main()
{
   FILE *fp;
   char buff[255];

   fp = fopen("input.txt", "r");
   if( fp != NULL ){
      while ( !feof(fp ) ){
         memset(buff, '\0', sizeof( buff) );
         fgets(buff, 255, (FILE*)fp);
         printf("%s", buff );
      }
      fclose(fp);
   }
}


This is the file you can use to provide input to your program and later on open it inside your program to process the input.