The central class in TPIE for reading from files and writing to files is the file_stream class.
It reads and writes primitives and primitive structures to files.
The main methods of interest are tpie::file_stream::open(), tpie::file_stream::close(), tpie::file_stream::read(), tpie::file_stream::write(), tpie::file_stream::seek().
By default, tpie::file_stream reads and writes blocks of size 2 MB at a time. You can change this by passing a block factor to the constructor of file_stream.