Last active
April 22, 2021 06:24
-
-
Save alsamitech/ad20193e01f354ab0f8211f30b814753 to your computer and use it in GitHub Desktop.
Requires: atokl aka compound_tokenizer, <stdio.h>, <stdlib.h>, <string.h>, and <ctype.h>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef struct _arr{ | |
| char* arr; | |
| size_t len; | |
| }arr_t; | |
| arr_t lines_from_file(char* filenm){ | |
| arr_t filedata; | |
| filedata.arr=read_file(filenm, &filedata.len); | |
| if(!filedata.arr){ | |
| arr_t a={0, 0}; | |
| return a; | |
| } | |
| arr_t arr; | |
| arr.arr=(char*)atokl(filedata.arr, "\n", &arr.len); | |
| return arr; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment