If two streams are opened, one as a binary stream and the other as text stream, and the same information is written to both, the contents of the stream may differ. The following illustrates two streams of different types. The hexadecimal values of the resulting files (which show how the data is actually stored) are not the same.
Figure 107. Comparison of Text Stream and Binary Stream Contents
|
As the hexadecimal values of the file contents shows in the binary stream (script.bin), the new-line character is converted to a line-feed hexadecimal value (0x25). While in the text stream (script.txt), the new-line is converted to a carriage-return line-feed hexadecimal value (0x0d25).
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.