From: David Webber on
Thanks again everyone for the various replies.

CStdioFileEx looks good and I plan to explore the other one too. For the
moment, I know the lines in the files I'm interested in have a finite
maximum length, and I have adopted the quick and dirty solution, which, for
the record, is:

FILE *fp = _wfopen( pszFilePath, L"rt, ccs=UNICODE" );

wchar_t szBuffer[512];

and then

fgetws( szBuffer, 511, fp );

until finished.

Not for C++ purists, I know <vbg>, but opening the file in this mode reads
and ANSI file if there's no BOM and a UTF-16LE file if the appropriate BOM
is there. This is sufficient for my current purposes.

Dave
--
David Webber
Mozart Music Software
http://www.mozart.co.uk
For discussion and support see
http://www.mozart.co.uk/mozartists/mailinglist.htm

From: Giovanni Dicanio on
"David Webber" <dave(a)musical-dot-demon-dot-co.uk> ha scritto nel messaggio
news:exQ4OjhlKHA.1824(a)TK2MSFTNGP04.phx.gbl...

> Not for C++ purists, I know <vbg>, but opening the file in this mode
> reads and ANSI file if there's no BOM and a UTF-16LE file if the
> appropriate BOM is there. This is sufficient for my current purposes.

The C++ I/O stream library is very slow if compared to both CRT (that you
are using) and of course Win32 memory mapped files.

I see nothing wrong in using C FILE* instead of C++ I/O streams in C++ code:
just use the right tool for the job :)

Giovanni


From: Tom Serface on
I say, whatever works for you and keeps you using MFC ... works for me :o)

Tom

"David Webber" <dave(a)musical-dot-demon-dot-co.uk> wrote in message
news:exQ4OjhlKHA.1824(a)TK2MSFTNGP04.phx.gbl...
> Thanks again everyone for the various replies.
>
> CStdioFileEx looks good and I plan to explore the other one too. For the
> moment, I know the lines in the files I'm interested in have a finite
> maximum length, and I have adopted the quick and dirty solution, which,
> for the record, is:
>
> FILE *fp = _wfopen( pszFilePath, L"rt, ccs=UNICODE" );
>
> wchar_t szBuffer[512];
>
> and then
>
> fgetws( szBuffer, 511, fp );
>
> until finished.
>
> Not for C++ purists, I know <vbg>, but opening the file in this mode
> reads and ANSI file if there's no BOM and a UTF-16LE file if the
> appropriate BOM is there. This is sufficient for my current purposes.
>
> Dave
> --
> David Webber
> Mozart Music Software
> http://www.mozart.co.uk
> For discussion and support see
> http://www.mozart.co.uk/mozartists/mailinglist.htm