Unit 4
Stream
Files
Streams
obj.open(filename, mode)
obj.close():
Binary Files
EOF
Pointers
Stream
When C program begins execution three predefined streams are automatically opened -
stdin, stdout, stderr
When C++ program begins four streams - cin, cout, cerr and clog
Cin is object of istream_withassign class which is derived from istream class
Cout is object of ostream_withassign class which is derived from ostream class
The stream class consists of the three areas:
1. Buffer system given by basic_streambuf. It supports I/O operations.
2. Specification system implemented by basic_ios class. This is high level I/O class
that provides formatting, error checking.
3. Translation system implemented by classes like istream, ostream.
Files
Streams
Ofstream write to file
Unit 4 1
Unit 4
Stream
Files
Streams
obj.open(filename, mode)
obj.close():
Binary Files
EOF
Pointers
Stream
When C program begins execution three predefined streams are automatically opened -
stdin, stdout, stderr
When C++ program begins four streams - cin, cout, cerr and clog
Cin is object of istream_withassign class which is derived from istream class
Cout is object of ostream_withassign class which is derived from ostream class
The stream class consists of the three areas:
1. Buffer system given by basic_streambuf. It supports I/O operations.
2. Specification system implemented by basic_ios class. This is high level I/O class
that provides formatting, error checking.
3. Translation system implemented by classes like istream, ostream.
Files
Streams
Ofstream write to file
Unit 4 1