SV: [LC++]NEWBIE: what is errno
Carlo Wood
carlo at alinoe.com
Sat Sep 22 01:56:04 UTC 2001
On Fri, Sep 21, 2001 at 12:08:11PM +0200, Jarmo Paavilainen wrote:
> Hi,
>
> "man errno" gives you all the answers you need.
>
> Basic usage is:
>
> #include <errno.h>
> #include <stdio.h>
>
> ...Do something that sets errno...
>
> printf( "errno is: %d %s\n", errno, strerror( errno ));
>
> // Jarmo
Shouldn't he subscribe to the C-programming mailinglist?
If you're coding C++, the basic usage is:
#include <cerrno> // Defines macro errno
#include <cstring> // Defines std::strerror
#include <iostream>
...Do something that sets errno...
std::cout << "errno is: " << errno << ' ' << std::strerror(errno) << '\n';
--
Carlo Wood <carlo at alinoe.com>
More information about the tuxCPProgramming
mailing list