Deutsch English Français Italiano |
<20241220123840.0000184d@yahoo.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S <already5chosen@yahoo.com> Newsgroups: comp.lang.c Subject: Re: Something like string-streams existing in "C"? Date: Fri, 20 Dec 2024 12:38:40 +0200 Organization: A noiseless patient Spider Lines: 44 Message-ID: <20241220123840.0000184d@yahoo.com> References: <vjvsvb$2i07u$1@dont-email.me> <vk179b$2s9oa$1@bluemanedhawk.eternal-september.org> <20241219114135.611@kylheku.com> <20241219220435.00001140@yahoo.com> <20241219140545.869@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Fri, 20 Dec 2024 11:38:44 +0100 (CET) Injection-Info: dont-email.me; posting-host="cd72757de727eb0edb19146209da36f1"; logging-data="3577881"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+K0T6daK6hgp43g4m4sOhEBZanFXFsrmg=" Cancel-Lock: sha1:XnpW1+fz4es4VD6iV6ezZAxp8wI= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 2392 On Thu, 19 Dec 2024 22:06:09 -0000 (UTC) Kaz Kylheku <643-408-1753@kylheku.com> wrote: > On 2024-12-19, Michael S <already5chosen@yahoo.com> wrote: > > On Thu, 19 Dec 2024 19:47:28 -0000 (UTC) > > Kaz Kylheku <643-408-1753@kylheku.com> wrote: > > =20 > >> On 2024-12-19, BlueManedHawk <bluemanedhawk@invalid.invalid> > >> wrote: =20 > >> > The =E2=80=98asprintf=E2=80=99 subroutine is standardized by POSIX.1= -2024, > >> > meaning that you can use it now and blame somebody else if it > >> > doesn't work. If you =20 > >>=20 > >> Regardless of how it is made visible, you can detect it via a > >> compile test in a configure script, and provide your own if it > >> wasn't found: > >>=20 > >> #if !HAVE_ASPRINTF > >>=20 > >> int asprintf(char **out, const char *fmt, ...) > >> { > >> ... // more or less trivial to implement using malloc, realloc > >> and vsprintf =20 > > > > Don't you mean, vsnprintf ? =20 >=20 > That detail will become obvious when you try to implement it. >=20 It sounds like Janis would prefer different API. struct string_buffer { char* ptr; size_t len; size_t cap; }; int append_printf(struct string_buffer*, , const char *fmt, ...); Implementation is as trivial as asprintf.