Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Michael S Newsgroups: comp.lang.c Subject: Re: Something like string-streams existing in "C"? Date: Thu, 19 Dec 2024 22:04:35 +0200 Organization: A noiseless patient Spider Lines: 42 Message-ID: <20241219220435.00001140@yahoo.com> References: <20241219114135.611@kylheku.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Date: Thu, 19 Dec 2024 21:04:38 +0100 (CET) Injection-Info: dont-email.me; posting-host="a37a7afdc6a200c65b6cb4dd23255f26"; logging-data="3163558"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19DY1ulUxqG0mKkva2+iL9E3yEl53YbipU=" Cancel-Lock: sha1:tuGtfFD7TsUw6V9F9H102QE4bdo= X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32) Bytes: 2330 On Thu, 19 Dec 2024 19:47:28 -0000 (UTC) Kaz Kylheku <643-408-1753@kylheku.com> wrote: > On 2024-12-19, BlueManedHawk wrote: > > The =E2=80=98asprintf=E2=80=99 subroutine is standardized by POSIX.1-20= 24, 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 Don't you mean, vsnprintf ? > } >=20 > #endif >=20 > BTW, is there no wchar_t version of this? >=20 > > can't target POSIX, the subroutine is also _theoretically_ > > available through the feature-test macro =E2=80=98__STDC_WANT_LIB_EXT2_= _=E2=80=99, > > assuming that =E2=80=98__STDC_ALLOC_LIB__=E2=80=99 is a predefined macr= o, but gLibC > > does not pay =20 >=20 > When would it be the case that you can't target POSIX, but *can* mess > around with some the internal feature test macros of some specific > POSIX vendor? :) >=20 >=20