Efficient Text File IO

File access for text files is done through the same functions (and classes) as file access for binary files. You determine whether to treat a file as a text file or as a binary file through a flag when opening the file. The difference between files that are opened as text files and those which are opened as binary files lies in whether or not the accessing functions interpret Carriage Return (CR) and Line Feed (LF) codes found in the file data. A binary file is seen as one long string of byte values, whereas a text file is seen as a collection of strings separated by CR and/or LF codes. Generally, programmers open and create text files only when they are to contain actual character data (such as that defined by ASCII or ...

Get C++ Footprint and Performance Optimization now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.