Windows CE 3.0: Application Programming (Prentice Hall Series on Microsoft Technologies)

< BACK  NEXT >
[oR]

In Windows CE, you can think of a file as a collection of bytes stored under a unique name in the Object Store. You can seek to any byte offset and read or write a block of bytes of any size.

Figure 2.1 shows two ways that you will access files in Windows. Files typically contain either text or binary data in the form of structures stored directly onto the disk. You can use the ReadFile and WriteFile functions toaccess these characters or structures. If you have ever used the fread and fwrite functions in stdio.h>, you will find the use of these API functions very similar.

Figure 2.1. Text files and files of structures

These same ReadFile and WriteFile functions appear throughout the Windows CE API in a variety of roles. You will use them, for example, to read from and write to communications ports and the network. In these applica- tions you will also be able to think of the data in terms of single characters or structures.

A number of functions in the Windows CE API allow you to gather information about a file once you open it. For example, given an open file you can determine its size, type, creation times, and so on. You can also use the Windows CE API functions to move, copy, and delete files.

< BACK  NEXT >

Категории