[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: question regarding scanw errors

From: Thomas Dickey
Subject: Re: question regarding scanw errors
Date: Wed, 11 Dec 2013 19:10:49 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

On Wed, Dec 11, 2013 at 04:54:10PM -0500, Ruslan Nabioullin wrote:
> Hello, the man page of scanw states "vwscanw  returns  ERR on
> failure..."; because scanw is an IO function, obviously failure
> implies "system" errors.  However, based on superficial testing,
> scanw returns ERR in case of the input, before the newline, being
> "blank" (empty or consisting of merely whitespace), instead of the
> intuitively-expected 0.
> My question is, how does one distinguish whether a "system" error
> occurred or the input was "blank", upon return of ERR?

essentially the same way one deals with scanf - prefer functions
that work from a buffer where you already know something of its
contents, e.g., sscanf.  In both cases (scanf/scanw), the return
code tries to do too much.

Thomas E. Dickey <address@hidden>

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]