Re: CFile ops using char or TCHAR



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
.



Relevant Pages

  • Re: Special characters in shortcut menus
    ... caption of the shortcut bar. ... Many of the chars don't error but are unprintable. ... the ChrW function which supports UniCode chars from 1 to 65536, ... > Does anyone have or know where I can find a listing of special characters ...
    (microsoft.public.excel.programming)
  • Re: HDITEM and LVITEM
    ... ANSI and a sequence of 2 byte characters in UNICODE. ... We agree on the meaning in Unicode (though surrogate pairs make exceptions to both of us). ... TCHARs at that address. ...
    (microsoft.public.win32.programmer.ui)
  • Re: Is anything easier to do in java than in lisp?
    ... > Java chars are now just like C chars, only they are fixed to 16 bit ... they are not unicode chars. ... using the first 128 characters as-is and the last 128 characters only ... the claim that a java character is a Unicode character is not ...
    (comp.lang.java)
  • Re: Is anything easier to do in java than in lisp?
    ... > Java chars are now just like C chars, only they are fixed to 16 bit ... they are not unicode chars. ... using the first 128 characters as-is and the last 128 characters only ... the claim that a java character is a Unicode character is not ...
    (comp.lang.lisp)
  • Re: Unicode Support
    ... >> (I know this is a poor example, but think about other languages, eg ... First things first, when you register your RosAsm windows classes, you ... the messages with ANSI / UNICODE parameters in ANSI or UNICODE form... ... with their alphabet characters, as with the numbers and punctuation...so, ...
    (alt.lang.asm)