Guest User

Untitled

a guest
Dec 8th, 2019
76
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5.  
  6. int main(int argc, char *argv[]) {
  7.  
  8. if(argc != 2){
  9. printf("Wrong number of arguments!\n");
  10. exit(EXIT_FAILURE);
  11. }
  12.  
  13. char ch;
  14. FILE * fp = fopen(argv[1], "r");
  15.  
  16. if(fp == NULL) {
  17. printf("Error opening file!\n");
  18. exit(EXIT_FAILURE);
  19. }
  20.  
  21. while((ch = fgetc( fp )) != EOF) {
  22.  
  23. if(isupper(ch)) {
  24. ch = ch + 32;
  25. }
  26. printf("%c", ch);
  27.  
  28. }
  29.  
  30. fclose(fp);
  31.  
  32. return EXIT_SUCCESS;
  33. }
RAW Paste Data