SHARE
TWEET

simple "read from file and write in cmd" code

a guest Apr 21st, 2019 102 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main(int argc, char *argv[])
  4. {
  5.     FILE *fp1;
  6.     char ch1;
  7.     long long ll;
  8.  
  9.     if((fp1=fopen(argv[1],"rb"))==NULL)
  10.     {
  11.         puts("Error opening file\n");
  12.         exit(1);
  13.     }
  14.  
  15.     while(!feof(fp1))
  16.     {
  17.         ch1=fgetc(fp1);
  18.         if(ferror(fp1))
  19.         {
  20.             puts("Error reading file\n");
  21.             exit(1);
  22.         }
  23.         printf("%c",ch1);
  24.     }
  25.  
  26.     fclose(fp1);
  27.  
  28. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top