std::streamsize

Header: <ios>

The type std::streamsize is a signed integral type used to represent the number of characters transferred in an I/O operation or the size of an I/O buffer. It is used as a signed counterpart of std::size_t, similar to the POSIX type ssize_t.

# Declarations

typedef /*implementation-defined*/ streamsize;

# Notes

Except in the constructors of std::strstreambuf, negative values of std::streamsize are never used.

# Example

#include <iostream>
#include <type_traits>
 
static_assert(std::is_signed_v<std::streamsize>);
 
int main()
{
    std::cout << sizeof(std::streamsize) << '\n';
}

# See also