FBB::IFdStream(3bobcat)

πŸ’– FBB::IFdStream β€” File Descriptor Input Stream πŸ’–

ok so bestie, you know how file descriptors are like… the raw, unhinged, no-C++-wrapper version of "here's a thing you can read from"? This is that, but as an actual C++ input stream. It's giving ✨glow-up✨ and honestly we're obsessed. The manual calls it FBB::IFdStream(3bobcat) btw, that's the whole vibe.


✨ NAME ✨

FBB::Ifdstream β€” Input Stream initialized by a File Descriptor

(yeah it's spelled with a little d in there, we don't question the naming choices of the past, we simply respect them 🫢)


🌸 SYNOPSIS 🌸

#include <bobcat/ifdstream>  (when using FBB::IFdStream
#include <bobcat/ifdstreams> (when using FBB::IFdStreamS

Linking option: -lbobcat

lowkey notice the headers are two different files depending on which class you're being, and also bestie, those parens in the original are unclosed. not me fixing them. πŸ™ˆ the manpage said it like that, so that's how it stays.


πŸ¦‹ DESCRIPTION πŸ¦‹

FBB::IFdStream objects are your go-to when you wanna extract information from devices whose file descriptors are available. like, the device gives you a file descriptor and you're like "cool, I want >> and getline on that" and boom, this class steps in.

FBB::IFdStreamS objects are the same energy as FBB::IFdStream objects, but they use FBB::Selector objects to do a lil vibe check first β€” they check whether information on the object's file descriptor is actually available before reading information from the file descriptor. so it's the "are you sure you're ready to talk to me" version. πŸ’…

ok important: 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 β€” so like, this is portable-ish, not portable-portable. ✈️ it's giving "works where it works".

also note: sockets can be used as file descriptors. yes really. sockets are just file descriptors wearing a cute outfit. πŸ”₯


πŸ‘‘ NAMESPACE πŸ‘‘

FBB

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


πŸ’œ INHERITS FROM πŸ’œ

std::istream

(yes, it's that istream. the one you already know. she's in the family. πŸŽ€)


🌈 CONSTRUCTORS 🌈

  • IFdStream(int fd, size_t n = 1) β€” the constructor initializes the object to read from descriptor fd, using a buffer of size n, by default having size 1. Use IFdStreamS(int fd, size_t n = 1) to construct an IFdStreamS object. ✨
Copy and move constructors (and assignment operators) are not available. so like, don't try to copy her, she does not do that. not available, not happening, not the vibe. πŸ’€

πŸŽ€ MEMBER FUNCTIONS πŸŽ€

All members of std::istream are available, as FBB::IFdStream(S) inherits from this class. There are no additional members.

that's it. that's the whole list. she brought nothing extra to the group chat, she's just here to be an istream. and honestly? iconic. 🫢


⭐ EXAMPLE ⭐

See the clientsocket(3bobcat) man-page for an example showing how to use IFdStream. go read that one bestie, that's where the demo lives. πŸ‘€


πŸ’… FILES πŸ’…

  • bobcat/ifdstream β€” defines the FBB::IFdStream class interface
  • bobcat/ifdstreams β€” defines the FBB::IFdStreamS class interface

πŸ”₯ SEE ALSO πŸ”₯

bobcat(7), ifdbuf(3bobcat), ofdstream(3bobcat), selector(3bobcat)

iykyk. go read the friends, they explain the lore. 🌈


πŸ’€ BUGS πŸ’€

ok so this is the part where you sit down and listen.

The IFdStream(S) object uses an IFdBuf(S) for its std::streambuf. This buffer is associated with the file descriptor passed to IFdStream(S)'s constructor. When the IFdStream(S) object goes out of scope, the device (file, socket, etc.) to which the file descriptor that was passed to IFdStream(S)'s constructor is not closed.

like. the stream leaves. the fd stays open. it does not clean up after itself. that's not a bug in your code, that's just how this works, but you need to KNOW it, fr fr. close your own descriptors. 😭


🧚 BOBCAT PROJECT FILES 🧚

Debian Bobcat project files:

  • libbobcat6: debian package containing the shared library, changelog and copyright note;
  • libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;

🌸 BOBCAT 🌸

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


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


πŸ’– AUTHOR πŸ’–

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


and that's the whole page bestie, you ate it, no crumbs, no cap. this lil angel shipped as part of libbobcat-dev version 6.15.01, dated 2005-2026 β€” yes the range is long, she's been serving for TWO DECADES, main character energy fr. πŸ’…βœ¨πŸ¦‹πŸ’œ

FBB::IFdStream(3bobcat) β€” signing off, stay hydrated, close your file descriptors. 🫢🌸

πŸ“¦ where this page comes from