Advertisement
Guest User

Untitled

a guest
Nov 11th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #define SIZE 2000
  5.  
  6. int main()
  7. {
  8. FILE *filePtr;
  9. char arr[SIZE] = "";
  10. printf("Please enter the file you would like to open: \n");
  11. scanf("%s", arr);
  12. strcat(arr,".txt");
  13.  
  14. filePtr = fopen(arr, "r");
  15. if(filePtr == NULL);
  16. {
  17. fprintf(stderr, "There was a problem opening the file \n");
  18. perror("Leaving now!!!\n");
  19. exit(-1);
  20. }
  21.  
  22. while( fgets(arr, SIZE, stdin) )
  23. {
  24. printf("0x%s\n", arr);
  25. }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement