I was writing a small utility to process some text files and was planning on loading the file into memory, line by line, and then performing some conditional transformations on each line, and writing them back out. I used the CStdioFile MFC class to do this and oddly it ended up loading only a single line with what showed only a pair of unprintable chars.
Opening the file in frhed (a nice free hex editor) showed that the file was Unicode and that the file started off with the BOM (byte-order mark used to indicate the byte ordering for the file). After google'ing this, I discovered that the MFC CStdioFile class just can't handle Unicode text files which contain the BOM.
Fortunately, I found the CStdioFileEx class written by David Pritchard. This is derived from CStdioFile and can be used the same way, but when loading Unicode files which contain the BOM it detects and handles them correctly.
So if you run into the BOM in a Unicode text file, check out CStdioFileEx.