Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Keith Thompson <kst-u@mib.org> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: perror()4 says SUCCESS |
| Date | 2011-11-22 13:57 -0800 |
| Organization | None to speak of |
| Message-ID | <lnvcqbu8fd.fsf@nuthaus.mib.org> (permalink) |
| References | <4ecb7bcf$0$292$14726298@news.sunsite.dk> <8LqdnR2ZJ69qWVbTnZ2dnUVZ7oednZ2d@giganews.com> <lnzkfnu9oi.fsf@nuthaus.mib.org> <-5mdnSwZeK6whFHTnZ2dnUVZ8h6dnZ2d@giganews.com> |
Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> writes:
> Keith Thompson ha scritto:
>> Vincenzo Mercuri<vincenzo.mercuri@yahoo.it> writes:
>>> arnuld ha scritto:
>> [...]
>>>> perror("*ERROR in ELSE");
>>> [...]
>>>
>>> Use printf("Error: %s\n", strerror(err)); instead or the Posix
>>> compliant and thread safe "strerror_r()".
>>
>> What's the advantage of that over perror()?
>>
>
> The point I was making was that while "perror()" prints the string
> representation of the *current* error described by "errno", with
> "strerror()" I can print out an error message that refers to a
> previously stored value of errno, such as "err" in this case.
Got it, thanks. (I'd still prefer to print the message to stderr rather
than stdout; that's easy enough to do.)
--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
perror()4 says SUCCESS arnuld <sunrise@invalid.address> - 2011-11-22 10:39 +0000
Re: perror()4 says SUCCESS jt@toerring.de (Jens Thoms Toerring) - 2011-11-22 11:44 +0000
Re: perror()4 says SUCCESS Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-22 04:15 -0800
Re: perror()4 says SUCCESS Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-22 07:51 -0500
Re: perror()4 says SUCCESS Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-22 16:51 +0100
Re: perror()4 says SUCCESS Keith Thompson <kst-u@mib.org> - 2011-11-22 13:30 -0800
Re: perror()4 says SUCCESS Harald van Dijk <truedfx@gmail.com> - 2011-11-22 13:35 -0800
Re: perror()4 says SUCCESS Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-22 22:51 +0100
Re: perror()4 says SUCCESS James Kuyper <jameskuyper@verizon.net> - 2011-11-22 16:43 -0500
Re: perror()4 says SUCCESS Ben Pfaff <blp@cs.stanford.edu> - 2011-11-22 15:36 -0800
Re: perror()4 says SUCCESS James Kuyper <jameskuyper@verizon.net> - 2011-11-22 18:52 -0500
Re: perror()4 says SUCCESS Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-22 22:50 +0100
Re: perror()4 says SUCCESS Keith Thompson <kst-u@mib.org> - 2011-11-22 13:57 -0800
Re: perror()4 says SUCCESS Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-22 23:05 +0100
Re: perror()4 says SUCCESS Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-22 23:26 +0100
Re: perror()4 says SUCCESS Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-11-22 20:40 -0500
csiph-web