This project covers the fundamental concepts of File I/O in the C programming language. It includes various tasks that involve creating, reading, writing, and manipulating files, understanding file descriptors, and working with ELF headers.
open
close
read
write
dprintf
lseek
printf
- Learn to create, open, close, read, and write files in C.
- Understand file descriptors and the three standard file descriptors: STDIN_FILENO, STDOUT_FILENO, STDERR_FILENO.
- Use I/O system calls such as
open
,close
,read
, andwrite
. - Work with flags like
O_RDONLY
,O_WRONLY
, andO_RDWR
when opening files. - Set file permissions using the
open
system call. - Understand the difference between functions and system calls.
- Gain knowledge about ELF headers and display information from them.
Write a function that reads a text file and prints it to the POSIX standard output.
Create a function that creates a file.
Write a function that appends text at the end of a file.
Write a program that copies the content of a file to another file.
Write a program that displays information contained in the ELF header at the start of an ELF file.
All C files should be compiled on Ubuntu 20.04 LTS using gcc
with the options -Wall -Werror -Wextra -pedantic -std=gnu89
. Each task has its own test cases to ensure correctness.
0x15-file_io/
main.h
: Header file containing function prototypes.0-read_textfile.c
: Task 0 implementation.1-create_file.c
: Task 1 implementation.2-append_text_to_file.c
: Task 2 implementation.3-cp.c
: Task 3 implementation.100-elf_header.c
: Task 4 (Advanced) implementation.- ...