• The output format should allow an input operator that can read the data without loss of information.
Especially for strings, this is close to impossible because a problem with spaces arises. A
space character in the string cannot be distinguished from a space character between two strings.
• The current formatting specification of the stream should be taken into account when doing I/O.
This applies especially to the width for writing.
• If an error occurs, an appropriate state flag should be set.
• The objects should not be modified in case of an error. If multiple data is read, the data should
first be stored in auxiliary objects before the value of the object passed to the read operator is set.
• Output should not be terminated with a newline character, mainly because it is otherwise impossible
to write other objects on the same line.
• Even values that are too large should be read completely. After the read, a corresponding error
flag should be set, and the value returned should be some meaningful value, such as the maximum
value.
• If a format error is detected, no character should be read, if possible.
• The output format should allow an input operator that can read the data without loss of information.
Especially for strings, this is close to impossible because a problem with spaces arises. A
space character in the string cannot be distinguished from a space character between two strings.
• The current formatting specification of the stream should be taken into account when doing I/O.
This applies especially to the width for writing.
• If an error occurs, an appropriate state flag should be set.
• The objects should not be modified in case of an error. If multiple data is read, the data should
first be stored in auxiliary objects before the value of the object passed to the read operator is set.
• Output should not be terminated with a newline character, mainly because it is otherwise impossible
to write other objects on the same line.
• Even values that are too large should be read completely. After the read, a corresponding error
flag should be set, and the value returned should be some meaningful value, such as the maximum
value.
• If a format error is detected, no character should be read, if possible.
การแปล กรุณารอสักครู่..