22 lines
404 B
C
22 lines
404 B
C
void
|
|
c_open(char *file) {
|
|
FILE *f = fopen(file + 2, "r");
|
|
if(f == NULL) { puts("couldnt open file."); return; }
|
|
b_truncate(buffer);
|
|
Row *row = buffer;
|
|
while (1) {
|
|
size_t red = 0;
|
|
for (int i = 0; i < ROW_SIZE; i++) {
|
|
red = fread(&row->text[i], 1, 1, f);
|
|
if (red != 1) return;
|
|
if (row->text[i] == '\n') {
|
|
row->text[i] = 0;
|
|
break;
|
|
}
|
|
}
|
|
row = b_insert(row);
|
|
}
|
|
fclose(f);
|
|
}
|
|
|