2. Files

< BACK  NEXT >
[oR]

Chapter 2. Files

File access is one of the most basic services provided by any operating system. Files in Windows CE are used in much the same way as files in other operating systems. They are generally used to store unstructured data such as text files. Windows CE also provides property databases (see Chapter 4) for storing structured data, and the registry for storing application-specific data such as settings or preferences. Files, databases, and the registry are stored, by default, in the Object Store (see Chapter 3).

This chapter discusses file access. It shows you how to open and close files, how to read and write from them, and how to gather information about files using the Windows CE API function. You can access files using either the Windows CE API functions, or the CFile class in MFC (as long as MFC is supported on the Windows CE platform you are targeting). You can use standard C or C++ functions (such as fopen and fwrite) for file input and output in Windows CE 3.0, however, the Windows CE functions provide much better control and more features.

Files are important in Windows because you access many different objects using the file routines. Certain techniques are used in the Windows CE API to open a file, read from it and write to it, and close the file. The Windows CE API uses identical techniques to work with communications ports (see Chapter 9). Therefore, understanding how to work with files is central to understanding serial communications tasks in WindowCE.

Files are quite interesting in Windows because of all the different capabilities built into the Windows CE for working with them. For example:

  • As you would expect, you can open, read, and write files.

  • You can open ANSI or Unicode text files and determine which character set is used to store text.

  • You can access a great deal of status information about files through the 32-bit API.

You can map files into the virtual memory system to significantly improve their performance and to manipulate large files. This technique is also used for high-speed inter-process communication

The Object Store and network resource access, closely related to files, are discussed in detail in the next chapter.


< BACK  NEXT >


Windows CE 3. 0 Application Programming
Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)
ISBN: 0130255920
EAN: 2147483647
Year: 2002
Pages: 181

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net