Re: using local buffers.

From: Naved A Surve (
Date: 09/15/95

In message <> you said:
> On Thu, 14 Sep 1995, Ron Poulton wrote:
> > Btw, I know I can 'return "string"' in order to return a string from a 
> > char* function, but if I have a local buffer, how would I return a string 
> > in the same manner without returning the address of the local buffer?

If you know you are going to be returning a string, why don't you pass a
character array as an argument to the function then have the function fill
it up?  That way, the function doesn't have to worry about allocating the
memory and you can take care of that in some consistant method at a higher
level in the program.

I am surprised I didn't see this suggested already.


This archive was generated by hypermail 2b30 : 12/07/00 PST