File: errnodescr.cc

package info (click to toggle)
bobcat 6.02.02-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 13,960 kB
  • sloc: cpp: 18,954; fortran: 5,617; makefile: 2,787; sh: 659; perl: 401; ansic: 26
file content (25 lines) | stat: -rw-r--r-- 452 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "exception.ih"

namespace FBB
{

std::ostream &errnodescr(std::ostream &out)
{
    if (errno != 0)
    {
        char *buffer = new char[Exception::STRERROR_BUFSIZE];

        if (char *cp = strerror_r(errno, buffer, Exception::STRERROR_BUFSIZE))
            out << cp;
        else
        {
            out << "internal error: strerror_r failed with errno = " << errno;
        }

        delete[] buffer;
    }

    return out;
}

} // FBB