summaryrefslogtreecommitdiff
path: root/buff.c
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-04-21 15:32:16 +0100
committerKatolaZ <katolaz@freaknet.org>2018-04-21 15:32:16 +0100
commit771b998ba5d1f451586aef0562d0012442d6bf23 (patch)
tree2f1c93699edd48a23d70d3655e35f2961e04c41d /buff.c
parentb10f9522863c937c08d41e2d6da48174cdb3906a (diff)
Fixed w and f
Diffstat (limited to 'buff.c')
-rw-r--r--buff.c21
1 files changed, 21 insertions, 0 deletions
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;
+}