Re: using local buffers.

From: Naved A Surve (naved@bird.taponline.com)
Date: 09/15/95


In message <Pine.SUN.3.91.950914111050.25380A-100000@eskimo.com> 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.


-Naved



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