std::basic_...:pubseekoff,(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’… std::basic_...:pubseekoff,(3)

okay so we’re in the C++ Standard Libary manual, bestie β€” yes, β€œLibary,” that’s literally how it’s spelled up top β€” and this page is all about std::basic_streambuf::pubseekoff. It’s giving β€œmove the stream position, but make it relative.” πŸ”₯


🌸 NAME

std::basic_streambuf::pubseekoff, β€” std::basic_streambuf::pubseekoff,

(yep, the trailing commas are literally part of the NAME line, no cap 😭)


✨ Synopsis

(1) public:

pos_type pubseekoff( off_type off, std::ios_base::seekdir dir,
                     std::ios_base::openmode which = ios_base::in |
                     ios_base::out );

(2) protected:

virtual pos_type seekoff( off_type off, std::ios_base::seekdir dir,
                          std::ios_base::openmode which = ios_base::in |
                          ios_base::out );

So what’s the vibe? It sets the position indicator of the input and/or output sequence relative to some other position. 🎯

  1. Calls seekoff(off, dir, which) of the most derived class.
  2. The base class version of this function has no effect. The derived classes may override this function to allow relative positioning of the position indicator.

πŸŽ€ Parameters

  • off β€” relative position to set the position indicator to.
  • dir β€” defines the base position to apply the relative offset to. It can be one of the following constants:
    • beg β€” the beginning of a stream
    • end β€” the ending of a stream
    • cur β€” the current position of stream position indicator
  • which β€” defines which of the input and/or output sequences to affect. It can be one or a combination of the following constants:
    • in β€” affect the input sequence
    • out β€” affect the output sequence

🫢 Note

Not all combinations of parameters may be valid, bestie β€” see the derived versions of seekoff for details. πŸ’–


πŸ‘‘ Return value

  1. The return value of seekoff(off, dir, which).
  2. The resulting absolute position as defined by the position indicator. The base class version returns pos_type(off_type(-1)).

πŸ¦‹ Example

This section is incomplete. Reason: no example.

literally the placeholder is giving β€œtrust me bro” energy 😭🫠


🩹 Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

  • DR: LWG 55
  • Applied to: C++98
  • Behavior as published: the base class version of seekoff returned an undefined invalid stream position
  • Correct behavior: returns pos_type(off_type(-1))

🌈 See also

  • pubseekpos β€” invokes seekpos() (public member function)
  • seekoff β€” repositions the file position, using relative addressing [virtual] (virtual protected member function of std::basic_filebuf<CharT,Traits>)
  • seekoff β€” repositions the next pointer in the input sequence, output sequence, or both, using relative addressing [virtual] (virtual protected member function of std::basic_stringbuf<CharT,Traits,Allocator>)
  • seekoff β€” repositions the next pointer in the input sequence, output sequence, or both, using relative addressing [virtual] (virtual protected member function of std::strstreambuf)

πŸ“ Category

  • Todo no example

source: cppreference.com Β· version/date: 2024.06.10 Β· page tag: std::basic_...:pubseekoff,(3) β€” periodt, bestie πŸ’œβœ¨

πŸ“¦ where this page comes from