[Tutor] Re: Exceptions vs error codes
Alan Gauld
alan.gauld at blueyonder.co.uk
Thu Aug 19 08:56:40 CEST 2004
> > I believe the problem is at the level of the OS open() call which
simply
> > returns an error (-1) with no distinction as to why it failed.
Thus
> Whenever anything bad happens in C standard library code, the
'errno'
> global variable is set to something useful. It's pervasive
throughout the
> C library. Good error reporting in C should be, in theory, as
simple as a
> call to perror().
I thought perror was a Unix thing?
It doesn't work under Windows, VMS etc?
But I've just tried it on XP and....it works!
> But this facility is also not well known to many C programmers, even
> experienced ones!
I've used perror for years on Unix but for some reason believed
it wasn't part of the C library but Unix only.
Between curses, getch and perror I'm not having a good week! :-)
Alan G.
More information about the Tutor
mailing list