The os_io.h header defines three variable types, several macros, and various functions for performing buffered input and output operations with files.
The following function signatures are exported by the os_io.h library:
SO_FILE *so_fopen(const char *pathname, const char *mode);
int so_fclose(SO_FILE *stream);
int so_fileno(SO_FILE *stream);
int so_fflush(SO_FILE *stream);
int so_fputc(int c, SO_FILE *stream);
size_t so_fread(void *ptr, size_t size, size_t nmemb, SO_FILE *stream);
size_t so_fwrite(const void *ptr, size_t size, size_t nmemb, SO_FILE *stream);
int so_fseek(SO_FILE *stream, long offset, int whence);
long so_ftell(SO_FILE *stream);
To use this functions you must add the os_io.h header in your source and specify at compile time where the library can be found
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
To use the os_io.h library on your projects you must have:
- for UNIX based operating systems:
- gcc - is a tool from the GNU Compiler Collection used to compile and link C programs
This is a step by step series of examples that tell you how to get a development env running.
- Linux:
- start by updating the packages list
$sudo apt-get update
- install the build-essential package(a package of new packages including gcc, g++ and make) by typing:
$sudo apt-get install build-essential
- start by updating the packages list
If you want to run the automated tests for Linux system you must follow the following steps:
- clone the repository by copping the following command in your terminal:
git clone https://github.com/gabriel-rusu/Operating-System-Input-Output-Library.git
- go into the project director and run the following command:
make test
- the results of the tests will be in the newly created file result.out
If you want to use the os_io.so library in your projects then you must add the os_io.h header in the desired source file and specify at the compile time the path to the os_io.so library.
- running the following command in the project director will generate the os_io.so:
make build
- Visual Studio Code - code editor
- GCC - used to compile the library on my Linux machine
- @gabriel-rusu - implementation