Re: Question about Extended ASCII character set, and fstream

From: B. v Ingen Schenau (bart_at_ingen.ddns.info)
Date: 10/21/04


Date: Thu, 21 Oct 2004 19:12:48 +0200

nospam@all.com wrote:

> Hey all,
>
> Quick question...been bugging me for some time, really. I have a
> console app, it does some things, and I want to save an array of text
> to a text file. The text consists of ASCII and extended ascii (codes 0
> to 255).

One problem with Extended ASCII codes is that nobody seems to agree on
which characters must be present in the extended portion of the
character set and what value to use for each extra character.

> I am using ofstream to output, and this is the line doing the
> actual output:
>
> outfile << screenbuffer[i].Char.AsciiChar;
>
> Note that screenbuffer is an array of type 'CHAR_INFO', quick info of
> it here:
>
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/char_info_str.asp
>
> Anyhow, the output, when I open it up in Notepad, shows ASCII
> characters fine, but nothing from the extended set (the extened set
> characters are garbled... into other characters.) When I put some
> extended ASCII chars into notepad (by holding ALT and pressing some
> numbers), they appear ok. When I try to save the file, it tells me I
> need to save in Unicode format.
>
> SOOOO, I cannot figure out how to output to a text file in Unicode
> format from my program. Any ideas?

You can try to write screenbuffer[i].Char.Unicode to a wofstream object.
And as this is essentially specific to your platform, you also might
want to ask for some advice in a group dedicated to your platform.

>
> Thanks in advance!
> Andy

Bart v Ingen Schenau

-- 
a.c.l.l.c-c++ FAQ: http://www.comeaucomputing.com/learn/faq
c.l.c FAQ: http://www.eskimo.com/~scs/C-faq/top.html
c.l.c++ FAQ: http://www.parashift.com/c++-faq-lite/


Relevant Pages

  • Re: Byte array to string
    ... > I had this problem where I had a program running on Korea where the codepage ... Careful here - there's no such encoding as "Extended ASCII". ... but the point is that a byte array isn't an array of characters. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CAtlRegExp crashes with pound sign!
    ... there are numerous Extended ASCII code pages. ... for 8-bit characters that'd be UTF-8. ... Microsoft MVP, MCSD ...
    (microsoft.public.vc.atl)
  • Re: How to display extended ASCII characters? (boxes, lines, etc)
    ... the extended ASCII characters past 127 will not appear ... |>there are /NO/ ASCII characters beyond 0x7F. ... that implementation is released as GPL. ... GPL fonts for CP437 and CP850 exist there as well. ...
    (comp.os.linux.questions)
  • Re: My trip America
    ... If it sounds like a scam, ... it's probably just the way that my news reader displays extended ASCII ... characters, but it appeared that the ticket cost the poster 3199. ...
    (rec.travel.usa-canada)
  • Re: OE v.6 - MIME/Quoted Printable?
    ... And I hope I haven't missed a FAQ somewhere ... found "OE-QuoteFix", ... characters when I hit "Reply Group". ... my OE news font set to 14 pt. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)