[PD] Converting t_symbol to type const char

Matthew Paradis mdjp100 at york.ac.uk
Mon May 20 17:25:32 CEST 2002


Hi Olaf,

Not sure how I missed that in the documentation/source code!
Thanks very much it works perfectly with both char and const char.

Regards

Matt

Olaf Matthes wrote:

> Hi Matthew,
>
> in case your fuction gets the hostname as 't_symbol *s', the code would
> look like this:
>
> char *host = s->s_name;
>
> I'm not shure if this would work with 'const char'...,
> In case you pass it a list (t_symbol *s, int argc, t_atom, argv):
>
> char *host = atom_getsymbolarg(i, argc, argv); /* with i = 0 to get the
> first element in the list */
>
> Olaf
>
> PS: you can send me your code off the list and I'll have a look at it
>
> Matthew Paradis schrieb:
>
> > Hi,
> >
> > I am currently trying to port a number of my jMax externals to pd. I'm
> > having a problem when setting up some of my network objects which take
> > as object arguments the host name followed by the port number. For
> > example [socksenddgs localhost 6537].
> > I need to assign this argument to a const char, however it will not
> > allow me to initialise the variable.
> > In jMax it works in the following way;
> >
> > const char *host;
> > int port;
> > socksenddgs_t *this = (socksenddgs_t *)o;
> > this->sockfd = -1;
> > host = fts_symbol_name(fts_get_symbol_arg( ac, at, 1,0));
> > port = fts_get_int_arg( ac, at, 2, 0);
> >
> > Any ideas or examples of converting string type arguments from the
> > object would be much appreciated
> >
> > Matt
> >
> > --
> >
> > Matthew Paradis
> > University of York
> > Music Department
> > Heslington,
> > York,
> > YO10 5DD,
> > UK
> > Tel: 0044-1904-43-2435
> > mdjp100 at york.ac.uk
> >
> >

--

Matthew Paradis
University of York
Music Department
Heslington,
York,
YO10 5DD,
UK
Tel: 0044-1904-43-2435
mdjp100 at york.ac.uk


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


More information about the Pd-list mailing list