---
name: "errno"
section: "3bobcat"
platform: "linux"
package: "libbobcat-dev"
version: "3.01.00-1+b1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/errno/3bobcat"
---

# errno(3bobcat)

Throwable objects handling error conditions

## NAME

FBB::Errno - Throwable objects handling error conditions

## SYNOPSIS

**#include \<bobcat/errno\>**\
 Linking option: *-lbobcat*

## DESCRIPTION

**FBB::Errno** objects may be thrown in exceptions.  As they are also **std::ostringstream** objects, information may be inserted into them. Facilitities are offered to insert information into, and to throw anonymous **FBB::Errno** objects.

*Errno* exceptions may be thrown by several Bobcat classes. These classes are  *Arg,*  *ArgConfig,* *BigInt,* *Cidr,* *ClientSocket,* *CmdFinder,* *CmdFinderBase,* *ConfigFile,* *DateTime,* *DecryptBuf,* *DigestBuf,* *EncryptBuf,* *Fork,* *GetHostent,* *Glob,* *HMacBuf,* *Hostname,* *InetAddress,* *level,* *LocalClientSocket,* *LocalServerSocket,* *LocalSocketBase,* *Log,* *MailHeaders,* *Mbuf,* *Milter,* *Mstream,* *OFoldStream,* *OFoldStreambuf,* *OneKey,* *Pattern,* *Pipe,* *Process,* *Redirector,* *Selector,* *ServerSocket,* *SocketBase,* *Stat,* *TempStream,* *User,* *Xpointer*

## NAMESPACE

**FBB**\
 All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace **FBB**.

## INHERITS FROM

**std::ostringstream, std::exception**

## CONSTRUCTORS

- o

  **Errno()**:\
   This constructor stores the current system *errno* value and its textual interpretation. No textual *errno* conversion is stored if *errno* equals 0.

- o

  **Errno(char const \*prefix)**:\
   This constructor stores the current system *errno* value. To this, the textual interpretation of **errno** is added unless **errno** equals 0. If, in this situation, **prefix** is a non-empty string, the text *:*  is first appended to the prefix.

- o

  **Errno(int errnr, char const \*text = 0)**:\
   This constructor stores the provided *errnr* value, and the *text* text. The *text* argument may be omitted or empty, in which case no text will be prefixed to any additionally inserted information. With this version of **FBB::Errno**, no *:*  is added to a non-empty *text* argument.   The copy constructor is available.

## MEMBER FUNCTIONS

All members of **std::ostringstream** and   **std::exception** are available, as **FBB::Errno** inherits from these classes.

- o

  **char const \*why() const**:\
   Returns the initialized and inserted text. *No* separators are inserted by the **FBB::Errno** object between the initializatin text and any text inserted later. If separators are required, the user of the **FBB::Errno** object must insert these explicitly. The same text is returned by *char* *const \*what() const*, which is part of *std::exception*’s interface.

- o

  **int which() const**:\
   Returns the internally stored **errno** value: either the system-**errno** value, or the value provided by the third constructor.

## OVERLOADED OPERATORS

- o

  **Errno const &operator\<\<(Errno const &in, Type const &t)**:\
   This overloaded insertion operator can be used to insert values of any type that can also be inserted into an *ostringstream* object. It is implemented as a template, with the generic *Type* representing the type of the value to be inserted. The overloaded assignment operator is not available.

## STATIC MEMBERS

The following convenience functions can be used for controlled opening of *std::istream, std::ostream* and *std::fstream* objects. If opening fails an *FBB::Errno(1)* exception is thrown containing a short message stating that the named stream could not be opened. If the stream was already open it is closed first.

- o

  **static void open(std::ifstream &in, std::string const &name,** **std::ios::openmode mode = std::ios::in)**:\
   Convenience function opening the object *ifstream in* refers to.

- o

  **static void open(std::ofstream &out, std::string const &name,** **std::ios::openmode mode = std::ios::out)**:\
   Convenience function opening (creating) the object *ofstream out* refers to.

- o

  **static void open(std::fstream &out, std::string const &name,**  **std::ios::openmode mode)**:\
   Convenience function opening the object *fstream out* refers to.

## EXAMPLE

The following example shows the normal use of the manipulators:

```
    if (exceptionalCondition)
        throw FBB::Errno(1, "Failure") << ": Exceptional condition occurred";
```

## FILES

*bobcat/errno* - defines the class interface

## SEE ALSO

[**bobcat**(7)](/bobcat/7.md)

## BUGS

None Reported.

## DISTRIBUTION FILES

- o

  *bobcat\_3.01.00-x.dsc*: detached signature;

- o

  *bobcat\_3.01.00-x.tar.gz*: source archive;

- o

  *bobcat\_3.01.00-x\_i386.changes*: change log;

- o

  *libbobcat1\_3.01.00-x\_\*.deb*: debian package holding the libraries;

- o

  *libbobcat1-dev\_3.01.00-x\_\*.deb*: debian package holding the libraries, headers and manual pages;

- o

  *http://sourceforge.net/projects/bobcat*: public archive location;

## BOBCAT

Bobcat is an acronym of \`Brokken’s Own Base Classes And Templates’.

## COPYRIGHT

This is free software, distributed under the terms of the  GNU General Public License (GPL).

## AUTHOR

Frank B. Brokken (**f.b.brokken@rug.nl**).
