Reading and Writing Files in C++

CPP_FILES is a directory of C++ programs which illustrate the use of files.


The computer code and data files made available on this web page are distributed under the GNU LGPL license.


A version of CPP_FILES is available in a C version and a C++ version and a FORTRAN90 version.

Related Data and Programs:

CPP, C++ programs which illustrate some of the features of the C++ programming language.

FILUM, a C++ library which can work with information in text files.

TABLE_IO, a C++ library which reads and writes table files.


  1. Paul Deitel, Harvey Deitel,
    C++: How to Program,
    Seventh Edition,
    Prentice Hall, 2011,
    ISBN: 978-013-216541-9,
    LC: QA76.73.C153.D45.
  2. Steve Oaulline,
    Practical C++ Programming,
    Second Edition,
    O'Reilly, 2003,
    ISBN: 1-56592-139-9,
    LC: QA76.73.C15.O84.
  3. Bjarne Stroustrup,
    The C++ Programming Language,
    Addison-Wesley, 2000,
    ISBN: 0-201-70073-5,
    LC: QA76.73.C153.S77.

Examples and Tests:

MICE is an example in which a file of strings is to be read.

You can go up one level to the C++ source codes.

Last revised on 29 April 2013.