[metadata]
id = "FIO14-C"
type = "recommendation"
category = "FIO"
number = 14
title = "Understand the difference between text mode and binary mode with file streams"
description = """
Input and output are mapped into logical data streams whose properties are more
uniform than their various inputs and outputs. Two forms of mapping are
supported, one for text streams and one for binary streams. They differ in the
actual representation of data as well as in the functionality of some C
functions. Characters may have to be altered to conform to differing conventions
for representing text in thehost environment. As a consequence, data read to or
written from a text stream will not necessarily compare equal to the stream's
byte content. The following code opens the filemyfileas a text stream:
"""
severity = "Low"
likelihood = "Probable"
priority = "P2"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 20, 2025"
[rules.cert_c.FIO14-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/FIO14-C.+Understand+the+difference+between+text+mode+and+binary+mode+with+file+streams"