[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: snprintf() revisited, please comment



Perhaps this is a silly question or has been covered already, but I'm 
curious:

> - find out overall length of n parts that shall be reassembled in some
>   way and add 1 for the terminating NUL
> - if re- or malloc()'ing the required buffer size failed, then

If you're allocating memory anyway, why wouldn't you use asprintf 
instead? That should basically do all the steps you listed for you. If 
need be, you can always add an asprintf implementation for those 
platforms that don't provide it natively. Is there anything against this 
approach?

	-- Bob



Visit your host, monkey.org