Re: C90 fpeek

Liste des GroupesRevenir à cl c 
Sujet : Re: C90 fpeek
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.lang.c
Date : 24. Jan 2025, 15:49:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20250124164954.00007935@yahoo.com>
References : 1 2 3
User-Agent : Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
On Fri, 24 Jan 2025 09:24:35 -0500
James Kuyper <jameskuyper@alumni.caltech.edu> wrote:

On 1/24/25 00:13, Keith Thompson wrote:
"Paul Edwards" <mutazilah@gmail.com> writes:
[...] 
With the benefit of hindsight, is there any reason why fpeek
couldn't have been added to C90, with implementations
being allowed with just a macro that returns some sort of
"unsupported"?
>
If fpeek (or similar) makes sense, can someone suggest an
appropriate interface? 
[...]
 
It would help to know what "fpeek" is supposed to do.  There no such
function in any edition of the C standard or in any implementation
that I'm aware of. 
 
A google search uncovered a stackoverflow question for which the
answer was:
 
int fpeek(FILE *stream)
{
    int c;
 
    c = fgetc(stream);
    ungetc(c, stream);
 
    return c;
}
 
I don't see any reason why such a function is needed in the standard
library. However, if it were added, since fgetc() and ungetc() are
mandatory for hosted implementations, I also see no reason to allow
for it to be unsupported.

It can be supported, but not useful for OP's purouses without ability
to set file to O_NONBLOCK. Which, I would think, is outside of C
standard.






Date Sujet#  Auteur
24 Jan 25 * C90 fpeek18Paul Edwards
24 Jan 25 +* Re: C90 fpeek16Keith Thompson
24 Jan 25 i+* Re: C90 fpeek3Paul Edwards
24 Jan 25 ii`* Re: C90 fpeek2Kaz Kylheku
24 Jan 25 ii `- Re: C90 fpeek1Paul Edwards
24 Jan 25 i+* Re: C90 fpeek3James Kuyper
24 Jan 25 ii`* Re: C90 fpeek2Michael S
26 Jan 25 ii `- Re: C90 fpeek1Lawrence D'Oliveiro
24 Jan 25 i`* Re: C90 fpeek9Kaz Kylheku
24 Jan 25 i +* Re: C90 fpeek4Chris M. Thomasson
25 Jan 25 i i+* Re: C90 fpeek2Kaz Kylheku
25 Jan 25 i ii`- Re: C90 fpeek1Chris M. Thomasson
26 Jan 25 i i`- Re: C90 fpeek1Lawrence D'Oliveiro
25 Jan 25 i +* Re: C90 fpeek3Paul Edwards
26 Jan 25 i i`* Re: C90 fpeek2Lawrence D'Oliveiro
27 Jan 25 i i `- Re: C90 fpeek1Paul Edwards
25 Jan 25 i `- Re: C90 fpeek1Kaz Kylheku
24 Jan 25 `- Re: C90 fpeek1Kaz Kylheku

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal