added writing capacilities to files and made the appropriate changes to the filedemo.c file

This commit is contained in:
Odweta
2023-12-23 18:28:58 +01:00
parent b9c93116bc
commit 0c68944a1d
9 changed files with 172 additions and 96 deletions
+7 -7
View File
@@ -2,7 +2,7 @@
I got bored with having to use complicated checking and stuff when working with files and arrays in C, so I implemented a new `file_t` struct which can load the contents of a file into a dynamically allocated array (yes, there is an implementation of those here as well... (`vector_t` struct)). The struct also stores the number of lines the file has.
Also, I managed to come up with an implementation of a Python-like list (a vector of vectors of any type interpreted as just one vector). Quite handy, I'd say. The `list_t` struct is what you want to use when working with lists.
Also, I managed to come up with an implementation of a kind-of-Python-like list (a vector of vectors of any type interpreted as just one vector). Quite handy, I'd say. The `list_t` struct is what you want to use when working with lists.
The difference between a `vector_t` and a `list_t` is that a vector can only be of one type, whereas a list can have values of any type inside it (in this context, any means types defined in this library and default types in C).
@@ -22,8 +22,7 @@ Examples of this work of art are in the `/examples/` directory of this repo.
3. Copy a file to another file
4. Move a file to another file
5. Rename a file
6. Delete a file
7. Empty a file
6. Delete a file?
8. Add line numbers at the beggining of each line in a file
+ You tell me
@@ -44,6 +43,7 @@ Examples of this work of art are in the `/examples/` directory of this repo.
1. Removing an element at a given index
2. Vectors of lists
3. Remove a value at a given index
+ You tell me
@@ -67,10 +67,10 @@ Examples of this work of art are in the `/examples/` directory of this repo.
## Installation
`git clone https://gitlab.com/Odweta/odwetalibc.git`
`cd odwetalibc`
`make install`
`git clone https://gitlab.com/Odweta/odwetalibc.git && cd odwetalibc && make install`
#### Run demo
`make && ./demo`
(the library has to be installed with `make install`)
`make && ./demo`