A function in the libc that'll print an error message to stderr based on errno. The only problem with this function is that different values for errno can have slightly different meanings depending upon which call set it, and perror will only print the most generic error message possible. However, I do love this function a lot, seeing how it saves programmers from doing an ugly switch() on errno upon error with common errno values and corresponding messages.

The Windows API really needs something like perror(). Badly. But MICROS~1 is dumb, so instead Windows apps will usually give you an integer as an error message; for anything more, a programmer will have to bend over backwards, and even then, he probably won't have every error code possible in his switch().
I stand corrected about the second paragraph; wharfinger has told me that there is a way to have perror()-like output in Windows using FormatMessage(), give it a FORMAT_MESSAGE_FROM_SYSTEM flag and it'll describe an error ID in a char *. maybe I should do a little research before I run the mouth. :)

Log in or register to write something here or to contact authors.