streamsize

Denotes the size of the stream.

#ifdef _WIN64
    typedef __int64 streamsize;
#else
    typedef int streamsize;
#endif

Remarks

The type is a signed integer that describes an object that can store a count of the number of elements involved in various stream operations. Its representation has at least 16 bits. It is not necessarily large enough to represent an arbitrary byte position within a stream.

Example

After compiling and running the following program, look at the file test.txt to see the effect of setting streamsize.

// ios_streamsize.cpp
// compile with: /EHsc
#include <iostream>
#include <fstream>

int main( ) 
{
   using namespace std;
   char a[16] = "any such text";
   ofstream x( "test.txt" );
   streamsize y = 6;
   x.write( a, y );
}

Requirements

Header: <ios>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions

Other Resources

<ios> Members