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
+4 -5
View File
@@ -4,9 +4,10 @@
#include <odweta/vector.h>
typedef struct {
char* path; // the file descriptor
int length; // line count
vector_t* lines; // 2d array of chars
char* path; // the file descriptor
int length; // line count
vector_t* lines; // 2d array of chars
int not_newline_terminated; // bool: 1 = true, 0 = false
} file_t;
file_t* fileInit(char* path); // initialization function
@@ -21,6 +22,4 @@ void fileWriteln(file_t* f, char* payload); // appends a given string to the fil
void fileWrite(file_t* f, char* payload); // appends a given string to the file (not on a newline!)
void fileClear(file_t* f); // wipes the file contents
#endif
+4 -4
View File
@@ -4,10 +4,10 @@
typedef long unsigned int size_t;
typedef enum {
INT,
FLOAT,
CHAR,
VECTOR // allows for multi-dimensional arrays
INT = 0,
FLOAT = 1,
CHAR = 2,
VECTOR = 3 // allows for multi-dimensional arrays
} dataType_e;
typedef struct {