Best way to return a string from an object
Chip Cox
Posts: 73
What is the best way ( reliability·considered better than speed )·to return or pass back a string value from an object?· I don't care if it's through storing it in an address that is passed into the routine, or whethere it's returned like a traditional inline function.·
Comments
It is also common practice for the caller to pass a pointer to a buffer that the caller provides.· You have to ensure that the buffer is large enough to hold the string plus the terminating null character.· It is a good idea to pass a buffer size also, so the called routine·can check to see if the buffer is large enough for the string.
I've tried debugging with viewport, but I keep running into problems every time I call an module in an object. It seems to get lost, so I can't trace through and see what's happening over there. I've spent 8 hours of a beautiful saturday on this. I think I'm going to go outside and approach it with a clear head this evening. Thanks
If you are using multiple cogs use very large stacks initially.· You can reduce them later on when everything is working OK.
Post Edited (Dave Hein) : 4/3/2010 11:20:57 PM GMT
You can even create multiple buffers that the called method can cycle through. This provides a little more persistence when required for, say, single expressions that include multiple calls to the object.
-Phil
thanks
Chip