Talk:C++ Programming/Code/Standard C Library/Functions/perror

Is this example code correct? I can't see where the colon gets printed from. I also think it should be "will produce something like the following" since it's implementation-defined. I don't have time to check this out right now, I'll come back to it. --Fishpi (talk) 08:00, 22 July 2010 (UTC)

The example code and the example output are correct. If you look at the C standard for perror, you'll see that, if you call perror with a "const char*" argument, then the character string pointed to by the argument, followed by a colon (":") and a space, then the error message string (corresponding to errno value) and a newline are all written to stderr. For fun, I tested the example code using the gcc compiler on an openSuSE 11.0 system, and it worked as advertised. --[Linuxfreak]


 * There doesn't seem to be any chance that if the condition is false the message wouldn't be shown. --Panic (talk) 04:03, 26 September 2010 (UTC)