473,503 Members | 11,783 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Code pages

J M
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????
Thanks in advance...

JF Mous
Nov 20 '05 #1
4 1042
Hi JM,

You code page has nothing to do with this directly.
The 437 is the American/English/Dutch/? page with usable codes in those
countries which does not exist in the standard 7 bits ASCI set in a one byte
character.

I know this gives no direct help, I will check it for you when I have some
more time.

I advise you to have a look at the streamwriter, encoded class.

http://msdn.microsoft.com/library/de...ctortopic7.asp

Cor
Nov 20 '05 #2
"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

Nov 20 '05 #3
J M
I've read the MSDN info on streamwriter (I'm not that familiar with it), but
its seems I can't create comma separated files with it...
The code I use now is like:

FileOpen(1, FileName, (...))
WriteLine(1, a string, another string, an integer, a double, a byte, .. etc)

The only streamwriter.writeline that accepts a paramarray wants a
formatstring first.
--
JM

"Armin Zingler" <az*******@freenet.de> schreef in bericht
news:40***********************@news.freenet.de...
<...cut...>

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

Nov 20 '05 #4
"J M" <a@b.com> schrieb
I've read the MSDN info on streamwriter (I'm not that familiar with
it), but its seems I can't create comma separated files with it...
The code I use now is like:

FileOpen(1, FileName, (...))
WriteLine(1, a string, another string, an integer, a double, a byte,
.. etc)

The only streamwriter.writeline that accepts a paramarray wants a
formatstring first.


Right, but you can use it to write in the format you need.
sw.writeline ("{0}, {1}, {2}, {3}", a string, another string,....)
--
Armin

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

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
5656
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
5
1892
by: John | last post by:
Dear all, I've got a security question that is so difficult that "maybe" there will be no answer for it. It's regarding protecting asp code. I did write some asp code, that I sell to...
3
1416
by: Ben Fidge | last post by:
I use the session_end in global.asax to perform clean-up of a temporary shopping cart table. Shoppping Cart items are stored with a session id in the table, and when a session ends a small rountine...
171
7583
by: tshad | last post by:
I am just trying to decide whether to split my code and uses code behind. I did it with one of my pages and found it was quite a bit of trouble. I know that most people (and books and articles)...
29
3645
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
232
13064
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
13
3515
by: Bob Jones | last post by:
Here is my situation: I have an aspx file stored in a resource file. All of the C# code is written inline via <script runat="server"tags. Let's call this page B. I also have page A that contains...
2
7494
by: zerodevice | last post by:
Hi, I'm trying to code my php that allows me to extract or fetch the html codes from another website, then i'll filter it myself to get only the specific text i want and display or echo it directly...
2
2159
by: RoomfulExpress | last post by:
The only problem I'm having with this code is when there are no values returned for the query, it is still allowing you to see and click the 'Next>>'. It disappears when there is at least one return...
3
1927
by: Hazza | last post by:
Hi, I am using PHP and mysql to create a website. I am fairly new to PHP, and thus am grateful to anyone who helps! Firstly I am running a homepage, that displays additional content if a user...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6976
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.