Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic


Denotes the size of the stream.

#ifdef _WIN64
    typedef __int64 streamsize;
    typedef int streamsize;

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.