C++.

.

/ - 5


ostream, .

write() ostream

read() istream :

read( char* addr, streamsize size )

read()

size

, addr. gcount()

, read(). read() istream, . getline(), gcount() write():

#include <iostream>

 

int main()

{

const int lineSize = 1024;

int lcnt = 0; //

int max = -1; //

 

char inBuf[ lineSize ];

 

// , 1024

while (cin.getline( inBuf, lineSize ))

{

//

int readin = cin.gcount();

 

// : ,

++lcnt;

if ( readin > max )

max = readin;

 

cout << " #" << lcnt

<< "\t : " << readin << endl;

 

cout.write( inBuf, readin).put('\n').put('\n');

}

 

cout << " : " << lcnt

<< endl;

cout << " : " << max << endl;

}

, :

#1 : 45

Call me Ishmael. Some years ago, never mind

 

#2 : 46

how long precisely, having little or no money

 

#3 : 48

in my purse, and nothing particular to interest