FBB::TempStream(3bobcat)

πŸ’– FBB::TempStream β€” the manual page, bestie edition πŸ’–

okay so you found the bobcat man page for FBB::TempStream, section 3. She's a Temporary fstream and honestly? iconic. let's get into it 🫢

✨ NAME ✨

FBB::TempStream β€” a Temporary fstream. short name, big energy. πŸ’…

🌸 SYNOPSIS 🌸

#include <bobcat/tempstream>

that's it. that's the whole vibe. include and go. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, FBB::TempStream objects are temporary std::fstreams, opened with mode 0600 β€” as in, user-only read+write, nobody else gets to peek, main character privacy only. πŸ‘‘

and here's the slay part: the file that a TempStream object creates gets removed from the file system the moment the TempStream object goes out of scope. auto-cleanup. it's giving responsible queen. no cap.

A TempStream object creates an empty file, and you can immediately insert information into the TempStream object. to switch between insertion and extraction, simply call seekg (for extraction) or seekp (for insertion). that's the whole trick, lowkey elegant.

under the hood, TempStream calls mkostemp(3) to construct the temporary file, which uses an extension of six characters beyond the base name that you specified as the argument to TempStream's constructor. six. characters. periodt. πŸ’…


🌈 NAMESPACE 🌈

FBB

All constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. so you already know what to type, bestie.

πŸŽ€ INHERITS FROM πŸŽ€

std::fstream

she's literally descended from royalty. πŸ‘‘

πŸ’œ CONSTRUCTORS πŸ’œ

  • TempStream(std::string const &base = "/tmp/FBB::TempStream") β€” The constructor initializes the object and creates a file with the given base-name, to which six random characters are appended. If the TempStream could not be constructed, an FBB::Exception is thrown. 😭
Copy and move constructors (and assignment operators) are not available. not up for grabs. do not attempt. πŸ™ˆ

πŸ“ MEMBER FUNCTIONS πŸ“

All std::fstream members are available, as FBB::TempStream inherits from this class. (yes, all of them. the whole inheritance bag. 🎁) In addition, TempStream itself offers:

  • std::string const &fileName() const β€” The name of the created temporary file. 🏷️
  • std::string const &filename() const β€” The name of the created temporary file. (same thing, different casing, both valid, we support both vibes. πŸ’…)

⭐ EXAMPLE ⭐

#include <iostream>
#include <bobcat/tempstream>

using namespace std;
using namespace FBB;

int main()
{
    TempStream ts("/tmp/demo");

    ts << "Hello world\n";

    ts.seekg(0);
    string line;
    getline(ts, line);
    cout << line << ", removed: " << ts.fileName() << ’\n’;
}

look at her go. write, rewind with seekg(0), read it back, print the filename, and then poof β€” gone when she's done. 😭✨

🧚 FILES 🧚

bobcat/tempstream β€” defines the class interface

πŸ‘‘ SEE ALSO πŸ‘‘

bobcat(7), mkostemp(3)

πŸ’€ BUGS πŸ’€

None reported. (iconic behaviour honestly, not a single complaint filed. πŸ”₯)

🌸 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’. (a backronym that ate, fr fr. 🫢)

This is free software, distributed under the terms of the GNU General Public License (GPL). free as in freedom bestie, go wild but respect the license. ✨

πŸŽ€ AUTHOR πŸŽ€

Frank B. Brokken (f.b.brokken@rug.nl). thank you king. πŸ‘‘


and that's the whole page, bestie! this is libbobcat-dev_6.15.01, dated 2005-2026, and you just read FBB::TempStream(3bobcat). slay, stay safe, and remember to let your temp files go out of scope. πŸ’…πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from