Re: Get ASCII value for character when higher than 127

Tech-Archive recommends: Speed Up your PC by fixing your registry



On 26 Maj, 21:12, "Jochen Kalmbach [MVP]" <nospam-
Jochen.Kalmb...@xxxxxxxxx> wrote:
Hi peter!

Ascii characters *never* contain values > 127!

Is this so? At least there is an option so you can choose between
having char signed or unsigned. So far as I remember, the C++ standard
has no requirement as the signedness of char.

C++ standard does not define ascii characters!
ISO defines ASCII which is in range 0x01 - 0x7f.

While I do agree with you on this point, if you read the OP, you must
surely agree with me that the poster used the phrase "ASCII" in the
sense of the current 8-bit codepage. This is technically incorrect,
but very common and can probably be found also in Microsoft
documentation.


It does not matter if you use char, int, short wchar_t or whatever...
ascii will never contains such numbers outside of this range.
If it contains such numbers, then you do not have ascii.

Of course. But the OP used a char to store "ASCII"-characters and
obviously had problems when those chars were negative.

/Peter

.



Relevant Pages

  • Re: backslash-issues
    ... where you can't be sure that you are using the ASCII ... > collating sequence if you interpret CHAR according to the Fortran95 ... The whole point of ACHAR is that it is more portable than CHAR ...
    (comp.lang.fortran)
  • Re: how real and integer values are saved in C language
    ... char c='a'; ... it will store 97 ... plz tell me things ... a integer value is stored in form of ascii or some thing else ...
    (comp.lang.c)
  • Re: CFile::Read problem ???
    ... As far as the C compiler is concerned, ... you can pretty much always assign a char ... > as ASCII and wchar_t as Unicode. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: ASCII value of a character
    ... >> character. ... In other words I'm looking for the reverse of char(). ... AFAIK ANSI is an extension of ASCII, ...
    (alt.comp.lang.borland-delphi)
  • Re: Blowfish Sign Extension bug still exists
    ... > of the compiliers I have used), it seems, given the set you ... I have used compilers where plain char is unsigned, ... in ASCII they are all positive. ...
    (sci.crypt)