Introduction
Files are the building blocks of any computer system. This chapter deals with portable handling of read-only application resources, and provides recipes to store the application data. We also use the code from Chapter 3, Networking, to organize asynchronous loading of resources from the .zip
archives.
Let us briefly consider the problems covered in this chapter. The first one is the access to application data files. Often, application data for desktop operating systems resides in the same folder as the executable file. With Android, things get a little more complicated. The application files are packaged in the .apk
file, and we simply cannot use the standard fopen()
-like functions, or the std::ifstream
and std::ofstream
classes.
The second problem results from the different rules for the filenames and paths. Windows and Linux-based systems use different path separator characters, and provide different low-level file access APIs.
The third problem comes from the fact that file...