Export (0) Print
Expand All

streamsize

Denotes the size of the stream.

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

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.

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 );
}

Header: <ios>

Namespace: std

Show:
© 2015 Microsoft