[PD] [gem] Looking for an abstraction for converting textfiles in text3d string

Charles Goyard cg at fsck.fr
Thu Feb 21 01:50:55 CET 2013


IOhannes m zmoelnig wrote:
> you can tell [textfile] to use CR/LF/CRLF as line delimiters by
> opening the file in "cr" mode, like
>  [open file.txt cr(
> 
> then you will need to stop through the lines by [bang(ing [textfile]
> till the end is reached. if you want to read the entire file at once,
> use [until] (with the 2nd outlet of [textfile] fed back to the 2nd
> inlet of [until], so it stops banging once the textfile is done.
> convert each line with [any2bytes], use [list append] to append '10'
> (the newline), and append those lists using another [list append].

Ok here's my take to this. I was unable to make it work with only two
list append, so I used 1 append and 2 prepend. There sure is a more
logical way to that. But at least it works :).

Please correct my patch and help me learn !

Thanks a lot for your help.

Charles
-------------- next part --------------
#N canvas 2 47 1276 751 10;
#X declare -lib moocow -lib Gem -lib mrpeach;
#X obj 210 472 gemhead;
#X obj 22 78 gemwin;
#X obj 267 472 prepend string;
#X obj 267 508 text3d;
#X obj 22 28 declare -lib moocow -lib Gem -lib mrpeach;
#X obj 220 288 textfile;
#X msg 220 209 clear \, read essai2.txt cr \, rewind;
#X obj 235 246 until;
#X obj 235 149 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 255 362 any2bytes;
#X obj 267 391 list append 10;
#X obj 267 446 list prepend;
#X obj 267 419 list prepend;
#X obj 235 174 t b b b;
#X msg 22 53 create \, 1 \, frame 5;
#X connect 0 0 3 0;
#X connect 2 0 3 0;
#X connect 5 0 9 0;
#X connect 5 1 7 1;
#X connect 6 0 5 0;
#X connect 7 0 5 0;
#X connect 8 0 13 0;
#X connect 9 0 10 0;
#X connect 10 0 12 0;
#X connect 11 0 2 0;
#X connect 11 0 12 1;
#X connect 12 0 11 0;
#X connect 13 0 7 0;
#X connect 13 1 6 0;
#X connect 13 2 12 1;
#X connect 13 2 11 1;
#X connect 14 0 1 0;
-------------- next part --------------
line 1 
line 2 
line 3 
line 4 
line 5 



More information about the Pd-list mailing list