FBB::IFdBuf(3bobcat)

File Descriptor Input Stream Buffer
(libbobcat-dev_6.06.01)

2005-2024

NAME

FBB::IFdBuf - Input stream buffer initialized by a file descriptor

SYNOPSIS

#include <bobcat/ifdbuf> (when using FBB::IFdBuf
#include <bobcat/ifdbufs> (when using FBB::IFdBufS

Linking option: -lbobcat

DESCRIPTION

FBB::IFdBuf objects may be used as a std::streambuf of std::istream objects to allow extractions from a file descriptor.

FBB::IFdBufS objects operate like FBB::IFdBuf objects but use FBB::Selector objects to check whether information on the object's file descriptor is available before reading information from the file descriptor.

File descriptors are not defined within the context of C++, but they can be used on operating systems that support the concept. Realize that using file descriptors introduces operating system dependencies.

NAMESPACE

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

INHERITS FROM

std::streambuf

ENUMERATION

The public enumeration Mode defined in the class FBB::IFdStreamBuf has the following values:

CONSTRUCTORS

Copy and move constructors (and assignment operators) are not available.

MEMBER FUNCTIONS

All members of std::streambuf are available, as FBB::IFdBuf(S) inherits from this class.

EXAMPLE

#include <unistd.h>

#include <istream>
#include <iostream>

#include <bobcat/ifdbuf>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
{
                           // define a streambuf of 20 or argv[1] characters
    IFdBuf buf{ STDIN_FILENO, argc == 1 ? 20 : stoul(argv[1]) };

    istream in{ &buf };

    cout << in.rdbuf();
}

FILES

bobcat/ifdbuf - defines the FBB::IFdBuf class interface
bobcat/ifdbufs - defines the FBB::IFdBufS class interface

SEE ALSO

bobcat(7), ifdstream(3bobcat), ofdbuf(3bobcat), std::streambuf

BUGS

The member xsgetn(char *dest, std::streamsize n) sets istream::good() to false when fewer bytes than n were read using istream::read(). Also see xsgetn's description.

Note that by default the provided file descriptors remain open. The complementary class ofdbuf(3bobcat) by default closes the file descriptor.

BOBCAT PROJECT FILES

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).