Re: Something like string-streams existing in "C"?

Liste des GroupesRevenir à cl c  
Sujet : Re: Something like string-streams existing in "C"?
De : thiago.adams (at) *nospam* gmail.com (Thiago Adams)
Groupes : comp.lang.c
Date : 20. Dec 2024, 12:32:24
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vk3kk8$3dt6g$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla Thunderbird
Em 12/20/2024 8:00 AM, Michael S escreveu:
On Thu, 19 Dec 2024 23:14:17 -0300
Thiago Adams <thiago.adams@gmail.com> wrote:
 
Em 12/19/2024 7:06 PM, Kaz Kylheku escreveu:
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:
 
On 2024-12-19, BlueManedHawk <bluemanedhawk@invalid.invalid>
wrote:
The ‘asprintf’ 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
>
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:
>
#if !HAVE_ASPRINTF
>
int asprintf(char **out, const char *fmt, ...)
{
    ... // more or less trivial to implement using malloc, realloc
and vsprintf
>
Don't you mean, vsnprintf ?
>
That detail will become obvious when you try to implement it.
  
>
I did on implementation in 2020 (not using it)
>
http://thradams.com/vadsprintf.html
>
 You mean, you don't use asprintf() that you implemented?
That's understandable. The API is rather badly designed. Can be handy
in toy examples, less so in production software.
 
For my needs a string stream is better I am using this
https://github.com/thradams/cake/blob/main/src/osstream.c
Unfortunately it is not compatible with FILE*.

>
The standard should have a string stream compatible with FILE because
- differently of asprintf - if cannot be implemented separately.
>
 What level of compatibility?
IMHO, the level that makes sense is where compatibility excludes
fopen, fclose and fflush. I.e. you have new functions, mem_fopen()
and mem_fclose() and do not allow fflush(). Pluse, you add few more
functions or macros for direct access to buffer.
 
A function printing in a FILE* fprint also should be able to print in a string stream.

Date Sujet#  Auteur
19 Dec 24 * Something like string-streams existing in "C"?15Janis Papanagnou
19 Dec 24 +- Re: Something like string-streams existing in "C"?1Keith Thompson
19 Dec 24 +- Re: Something like string-streams existing in "C"?1Lawrence D'Oliveiro
19 Dec 24 +* Re: Something like string-streams existing in "C"?11BlueManedHawk
19 Dec 24 i`* Re: Something like string-streams existing in "C"?10Kaz Kylheku
19 Dec 24 i `* Re: Something like string-streams existing in "C"?9Michael S
19 Dec 24 i  `* Re: Something like string-streams existing in "C"?8Kaz Kylheku
20 Dec 24 i   +* Re: Something like string-streams existing in "C"?6Thiago Adams
20 Dec 24 i   i`* Re: Something like string-streams existing in "C"?5Michael S
20 Dec 24 i   i +* Re: Something like string-streams existing in "C"?3Thiago Adams
20 Dec 24 i   i i+- Re: Something like string-streams existing in "C"?1Michael S
20 Dec 24 i   i i`- Re: Something like string-streams existing in "C"?1Lawrence D'Oliveiro
20 Dec 24 i   i `- Re: Something like string-streams existing in "C"?1Keith Thompson
20 Dec 24 i   `- Re: Something like string-streams existing in "C"?1Michael S
20 Dec 24 `- Re: Something like string-streams existing in "C"?1Janis Papanagnou

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal