Memory allocation for wm_strGetParameterString


#1

I’m a bit worried about using wm_strGetParameterString (ascii * dst, const ascii * src, u16 Position), because I don’t know how big to make ‘dst’.

Or have I got the wrong idea ? Does wm_strGetParameterString do the allocation for me ? So all i have to do is declare a pointer.

I know the parameters I’m expecting will be xx in length, but its those unexpected things that I’m worried about. Especially when you consider that many OpenAT parameter string types seem to have u16 length fields.

It would be great if someone knows this, else I’ll just have to do some testing and find out the hard way.

John


#2

Well, it can’t be any more than strlen(src) - can it?

No, that couldn’t work - could it?
If the function did the allocation, then it would need to set the pointer to point to the data that it allocated - so you would need to pass a pointer to the pointer.

The ADL User Guide tells you:

(my emphasis)


#3

Thanks, very concise and clear as always. Obvious really, I think I’ve been staring at this stuff for too long.