repositories
/
TD_C.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
TP_13: Fix the Cygwin support in the buildsystem
[TD_C.git]
/
TP_12
/
exo2
/
exo2.c
1
#include <stdio.h>
2
#include <stdlib.h>
3
4
int
main
() {
5
char
ch
;
6
char
*
fname
;
7
FILE
*
fp
;
8
9
printf
(
"Enter the name of the file you wish to see
\n
"
);
10
scanf
(
"%s"
,
fname
);
11
12
fp
=
fopen
(
fname
,
"r"
);
/* read mode */
13
if
(
fp
==
NULL
) {
14
perror
(
"Error while opening the file.
\n
"
);
15
exit
(
EXIT_FAILURE
);
16
}
17
18
printf
(
"The content of %s file is :
\n
"
,
fname
);
19
20
while
((
ch
=
fgetc
(
fp
)) !=
EOF
)
21
printf
(
"%c"
,
ch
);
22
23
fclose
(
fp
);
24
25
return
EXIT_SUCCESS
;
26
}