For Programmers: Free Programming Magazines  


Home > Archive > C > February 2006 > Re: scanf (yes/no) - doesn't work + deprecation errors scanf, fopen









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: scanf (yes/no) - doesn't work + deprecation errors scanf, fopen
Joe Wright

2006-02-25, 6:55 pm

ptk wrote:
> On 2006-02-16 15:41:23 -0600, Al Balmer <albalmer@att.net> said:
>
>
>
> man fpurge
>
> I think he meant fpurge not __fpurge. At any rate, fpurge is in stdio
>

It is in my DJGPP setup but nonetheless..

Syntax
------

#include <stdio.h>

int fpurge(FILE *file);

Description
-----------

If FILE designates a buffered stream open for writing or for both
reading and writing, this function purges the stream's buffer without
writing it to disk. Otherwise, it does nothing (so it has no effect on
read-only streams such as `stdin').

Return Value
------------

Zero on success, -1 on failure.

Portability
-----------

not ANSI, not POSIX

Read it and weep.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---
Chris Torek

2006-02-26, 3:55 am

In article < fd2dnWVItfHZ9Z3ZnZ2dneKdnZydnZ2d@comcast
.com>
Joe Wright <joewwright@comcast.net> wrote:
>[The fpurge() function] is in my DJGPP setup but nonetheless..

[... snippage]
>If FILE designates a buffered stream open for writing or for both
>reading and writing, this function purges the stream's buffer without
>writing it to disk. Otherwise, it does nothing (so it has no effect on
>read-only streams such as `stdin').

[...]
>Portability
>-----------
>not ANSI, not POSIX


And not compatible with the 4.4BSD fpurge() (which I wrote):

The function fpurge() erases any input or output buffered in the given
stream. For output streams this discards any unwritten output. For input
streams this discards any input read from the underlying object but not
yet obtained via getc(3); this includes any text pushed back via ungetc.

Hence, there are multiple functions with the same or similar names
that do different things. This is one of several risks you take
if you choose to use non-Standard functions.
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com