Re: Code pages

From: Armin Zingler (az.nospam_at_freenet.de)
Date: 05/10/04


Date: Mon, 10 May 2004 12:55:55 +0200


"J M" <a@b.com> schrieb
> Hi,
>
> I'm working on a program that writes data to a DOS-file (a file that
> is to be read by a DOS-program), thus using codepage 437.
> When writing to a binary file there was no problem at all, I just
> used GetEncoder(437) to write the byte arrays to the file.
> But I also have to write to a sequential file. WriteLine doesn't
> support byte arrays.
> I ended up first encoding the strings to byte arrays, writing them to
> a binary file, opening that binary file as a sequential file, reading
> the byte arrays as strings again and then writing the records
> (containing a.o. those strings) back to the sequential file I finally
> needed.
>
> I hate this method. It takes way to long (I'm talking about over
> 20000 records)!
>
> Is there any way that I can convert the unicode strings directly to
> codepage 437 and writing them to a sequential file????

Maybe I'm overlooking the problem, but when creating the Streamrwriter, you
can pass the Encoding object that you created before.

-- 
Armin
How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


Relevant Pages

  • Code pages
    ... When writing to a binary file there was no problem at all, ... GetEncoderto write the byte arrays to the file. ... But I also have to write to a sequential file. ... arrays as strings again and then writing the records (containing a.o. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Initializer for an array of pointers to arrays of strings
    ... > I was wondering whether the is a more elegant way of writing such an ... > Is there something similar for arrays of pointers to arrays of strings? ...
    (comp.lang.c)
  • Re: I need some basic C++ help
    ... I think the idea of using arrays for strings (one that comes entirely ... the students need to see how strings can be constructed using arrays ... > One reason is that they spend much less time debugging. ...
    (comp.lang.cpp)
  • Re: more idle thinking: SiMPL
    ... int *pi; ... memory for strings and arrays are dynamicly allocated, ...
    (comp.lang.misc)
  • What I want in an editor/IDE
    ... I started writing this list because I wanted to have definite points ... start writing yet another IDE and so am now thinking in terms of new ... See the code outliner below. ... strings, normal strings and triple ...
    (comp.lang.python)

Quantcast