How To Read And Write Text Files In A Modern C++ App
Text files manipulation routines are important for everyday computer usage. We use them to read data, to search a part of data in its data, to obtain values from data, or to record our values as new data. Moreover, many common file types are actually in text form even though it might not be immediately obvious. For example, JSON files, XML files, C source code, C++ source, .H header files, .PAS Pascal program files, and SQL Scripts are all types of ‘plain’ text file. Since the first version of C was released, C and c++ writing to a file have had a lot of functions to read and write on these text files but you had to be quite careful because it wasn’t difficult to make mistakes which could have some unintended side effects or errors.