Created
October 17, 2017 14:05
-
-
Save iwouldnot/4cb8c5c4c3e1ac91de525ddd7698a7f7 to your computer and use it in GitHub Desktop.
спешл фо даша
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> // For exit() | |
int main() | |
{ | |
FILE* fptr; | |
char filename[100], c; | |
printf("Enter the filename to open \n"); | |
scanf("%s", filename); | |
// Open file | |
fptr = fopen(filename, "r"); | |
if (fptr == NULL) { | |
printf("Cannot open file \n"); | |
exit(0); | |
} | |
scanf("%s", filename); | |
// Open file | |
fptr = fopen(filename, "r"); | |
if (fptr == NULL) { | |
printf("Cannot open file \n"); | |
exit(0); | |
} | |
// Read contents from file | |
c = fgetc(fptr); | |
while (c != EOF) { | |
printf("%c", c); | |
c = fgetc(fptr); | |
} | |
fclose(fptr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment