diff options
| author | Soikk | 2025-11-05 20:52:52 +0100 |
|---|---|---|
| committer | Soikk | 2025-11-05 20:52:52 +0100 |
| commit | 659e34f07c05e00baf10417503111048cbc634e3 (patch) | |
| tree | 090d2f1ad6201a71bafe155d354c79af5a4ce393 /str/str.h | |
| parent | 009e1f2b15c8de452c5c245d99640859a458e86c (diff) | |
| download | soikk-libs-659e34f07c05e00baf10417503111048cbc634e3.tar.xz soikk-libs-659e34f07c05e00baf10417503111048cbc634e3.tar.zst | |
Added string to file functions
Diffstat (limited to 'str/str.h')
| -rwxr-xr-x | str/str.h | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -112,8 +112,12 @@ str fp_to_str(FILE *fp); str fp_to_nstr(FILE *fp, u32 len); str file_to_str(char *filename); str file_to_nstr(char *filename, u32 len); +#define str_to_fd(s, fd) write(fd, s.ptr, s.len) +#define str_to_fp(s, fp) fwrite(s.ptr, sizeof(str.ptr[0]), s.len, fp) +void str_to_file(str s, char *filename); + str map_file(char *filename); -// consider adding 'at' to other file-to-str functions +// TODO: consider adding 'at' to other file-to-str functions str map_file_at(char *filename, int len, int at); void unmap_file(str *s); |
