[PD] external: method to convert t_atom to c string.

J Oliver jaime.oliver2 at gmail.com
Mon May 20 05:47:20 CEST 2013


Hello all, 

I need to create a textfile from inside an external and I need to give the computer a path with a message like:

path /home/path/file.txt

I am therefore creating a method for path with:

	class_addmethod(testtext_class, (t_method)testtext_path, gensym("path"), A_GIMME, 0); 

Or should I use A_DEFSYMBOL ? 

But then how can I read the atom inside the external?

I am using:

void testtext_path(t_testtext *x, t_atom *s){
	char teststring[1000];
	atom_string(s, teststring, 1000);
	post(teststring);
}

but then I get the following printout:

consistency check failed: atom_string
333333@ÿÿÿÿs

I'm not sure where to move with this. anybody has any suggestions?

best,

J

Here's the info for atom_string:
atom_string

void atom_string(t_atom *a, char *buf, unsigned int bufsize);
Converts an atom a into a C-string buf. The memory to this char-Buffer has to be reserved manually and its length has to be declared in bufsize.

in: http://pdstatic.iem.at/externals-HOWTO/node9.html#SECTION00092200000000000000













-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20130519/2cb8fe9c/attachment.htm>


More information about the Pd-list mailing list