Re: CFile ops using char or TCHAR
- From: r_z_aret@xxxxxxxxxxxx
- Date: Mon, 28 Nov 2005 18:18:08 -0500
On Thu, 24 Nov 2005 18:57:46 +1100, "Steve McKewen"
<steve.mckewen@xxxxxxxxxxxxxx> wrote:
>I have been trying to find an intermittent bug in my file handling and have
>just noticed that my file handling class is working chars not TCHARs. My
>file operations stop with a SECTOR_NOT_FOUND exception after 7 days of
>operation.
>
>The help files show the parameters for Read and Write as
>virtual void Write(
>const void* lpBuf,
>UINT nCount ); Parameters
> lpBuf
> Specifies a pointer to the user-supplied buffer that contains the data to
>be written to the file.
> nCount
> Specifies the number of bytes to be transferred from the buffer. For
>text-mode files, carriage return-linefeed pairs are counted as single
>characters.
>but, all the examples show TCHARs.
>
>Do I need to be working in wide chars for CFile operations, or are chars OK?
When you call Write, you need to use the type of characters you want
in the file. When you call Read, you need to use the type of
characters that are in the file. I don't use MFC, so I can't vouch for
the MFC versions of Read and Write. I do know that the base (straight
Win 32) versions expect _bytes_ and don't care what the bytes
represent.
If you are using ASCII characters in a file, then you will probably
need to translate from UNICODE on the way in and out, because Windows
CE is heavily biased towards UNICODE.
If you are not familiar with UNICODE and its implications, I
_strongly_ urge taking time to study them, rather than asking
questions and learning bits and pieces. There are some subtleties, and
you can waste a lot of _your_ time. For starters, I recommend using
google (http://groups.google.com/advanced_group_search) to look up
unicode
in this newsgroup. I also suggest using google to look up
cstring unicode
>I am using an ARM processor based system.
>
>TIA
>Steve McKewen
>
-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
.
- Follow-Ups:
- Re: CFile ops using char or TCHAR
- From: Steve McKewen
- Re: CFile ops using char or TCHAR
- References:
- CFile ops using char or TCHAR
- From: Steve McKewen
- CFile ops using char or TCHAR
- Prev by Date: Re: "Platform manager cannot create the communication streams needed by the debugger" error
- Next by Date: RE: Type Mismatch error in eVC++ with BSTR type
- Previous by thread: CFile ops using char or TCHAR
- Next by thread: Re: CFile ops using char or TCHAR
- Index(es):
Relevant Pages
|