[PD] external: method to convert t_atom to c string.
J Oliver
jaime.oliver2 at gmail.com
Mon May 20 06:51:27 CEST 2013
of course!!
thanks,
J
void testtext_path(t_testtext *x, t_symbol *s, int argc, t_atom *argv) {
char teststring[1000];
atom_string(argv, teststring, 1000);
post(teststring);
}
On May 19, 2013, at 11:28 PM, Miller Puckette wrote:
> Hi Jaime -
>
> If you use A_GIMME the function prototype has to be as in:
>
> void testtext_path(t_testtext *x, t_symbol *s, int argc, t_atom *argv).
>
> cheers
> Miller
>
> On Sun, May 19, 2013 at 10:47:20PM -0500, J Oliver wrote:
>> 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
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>> _______________________________________________
>> Pd-list at iem.at mailing list
>> UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>
More information about the Pd-list
mailing list