Reading and Writing Files in C
- Read the current source file
Implement a small C program consisting of a single source file
readme.c
. The program must print its own source code
to stdout
. To do so, use the functions fopen(.)
and fgetc(.)
. You can implement this directly in
main(.)
.
Name the source file: readme.c
- Extended ASCII Codes
Implement a C program that reads its own source code and prints each
character's ascii code on a separate line. Note: you don't need a separate
function to obtain a char's ascii code.
Name the source file: ascii.c
- Number of Lines
Implement a C program that prints the number of lines of a given file to
stdout.
Name the source file: line_count.c