PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] asprintf
Date: Thursday, 17 Sep 2020, 09:01:25


    > Message Posted By: Unknown
    >
    > int asprintf(char **strp, const char *fmt, ...);
    >
    > Does asprintf handle memory allocation for us? I.e., if *strp were already
    > a malloc'd string and asprintf found it necessary to call malloc, would it
    > free the old memory then set *strp to the new malloc allocation?

Yes.  No.  See the man page for asprintf() for details.

--Stan-
PREV INDEX NEXT