Opening and Reading from a File

Let's say that you want to write a program that performs the simplest possible file operation: you want to open a file, read from it, and write its contents to the screen. First, however, you need to determine what type of text file you have. The file could contain single-byte characters using the ANSI character set. Alternatively, the file could contain text using Unicode characters, where two bytes are used to store each character. Further, Unicode characters can be stored with the most significant byte either first or last. It is important to determine which byte-ordering scheme is being used before the file is read.

In Unicode text files, the first two characters have the value 0xfeff if the file is a Unicode ...

Get Windows® CE 3.0 Application Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.