aboutsummaryrefslogtreecommitdiff
path: root/src/fwriteln.c
diff options
context:
space:
mode:
authorFranz Zotter <fzotter@users.sourceforge.net>2007-08-16 22:23:41 +0000
committerFranz Zotter <fzotter@users.sourceforge.net>2007-08-16 22:23:41 +0000
commit9671355d99de111ca17ec4e862da0cb79c69f4d5 (patch)
treecea59d551ac18b1c9a39631435b756b067f99b76 /src/fwriteln.c
parentb19be3cca1a839593c952e0bb17b11119a2e6436 (diff)
freadln:
repaired the file read error in freadln and added the textfile/msgfile mode with ";" fwriteln: added the textfile/msgfile compatible mode with ";" svn path=/trunk/externals/zexy/; revision=8602
Diffstat (limited to 'src/fwriteln.c')
-rw-r--r--src/fwriteln.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/fwriteln.c b/src/fwriteln.c
index ae09f9c..0525433 100644
--- a/src/fwriteln.c
+++ b/src/fwriteln.c
@@ -42,6 +42,7 @@ typedef struct fwriteln
FILE *x_file;
char *x_filename;
char *x_textbuf;
+ char linebreak_chr[3];
} t_fwriteln;
@@ -65,10 +66,15 @@ static void fwriteln_open (t_fwriteln *x, t_symbol *s, t_symbol*type)
filename[MAXPDSTRING-1]=0;
fwriteln_close (x);
- if(0==type || type!=gensym("cr")) {
+/* if(0==type || type!=gensym("cr")) {
pd_error(x, "unknown type '%s'", (type)?type->s_name:"");
return;
- }
+ }*/
+
+ if (type==gensym("cr"))
+ strcpy(x->linebreak_chr,"\n");
+ else
+ strcpy(x->linebreak_chr,";\n");
if (!(x->x_file=fopen(filename, "w"))) {
pd_error(x, "failed to open %128s",filename);
@@ -144,7 +150,7 @@ static void fwriteln_write (t_fwriteln *x, t_symbol *s, int argc, t_atom *argv)
argv++;
}
- snprintf(text,MAXPDSTRING,"\n");
+ snprintf(text,MAXPDSTRING,x->linebreak_chr);
length=strlen(text);
if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
pd_error(x, "failed to write %128s",x->x_filename);