From 771b998ba5d1f451586aef0562d0012442d6bf23 Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Sat, 21 Apr 2018 15:32:16 +0100 Subject: Fixed w and f --- buff.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'buff.c') diff --git a/buff.c b/buff.c index 96cb12f..6462230 100644 --- a/buff.c +++ b/buff.c @@ -273,3 +273,24 @@ void change_lines(){ addr2 = addr1 =pos; append_lines(); } + + + +int write_lines(){ + FILE *fout; + line_t *l; + int tot=0; + + if (! (fout = fopen(fname, "w+"))){ + return -1; + } + + l = b_start; + while(l){ + tot += fprintf(fout, "%s", l->c); + l = l->next; + } + fclose(fout); + printf("%d\n", tot); + return 0; +} -- cgit v1.2.3