473,325 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Oem to Ansi

I got an OEM file and I use a StreamReader to read it but I got a problem
that the file may got some characters that StreamReader can not read so it
reads only some data of it.

eg.

Dim StreamToDisplay As New StreamReader("C:\OEMFILE.DAT", _
Encoding.GetEncoding(CultureInfo.CurrentCulture.Te xtInfo.OEMCodePage))
Dim aLine As String
Do
aLine = StreamToDisplay.ReadLine
TextBox1.Text += aLine + Chr(13) + Chr(10)
Loop Until aLine = Nothing
StreamToDisplay.Close()

When it ends then I see at the TextBox that the file is has not be read
right. I tried the FileOpen method but the same problem occured.
The encoding is correct cause when I open the OEMFILE.DAT through the
Notepad and simple save it with the same name then the StreamReader can read
it correct. But the point is that it must be done without the help of the
Notepad.

Any help ?
Nov 21 '05 #1
1 3472
Hi Rastarizer,

I hope that this thread help you;
http://www.dotnet247.com/247referenc...54/270997.aspx

Kind Regards,

Jorge Serrano Pérez
MVP VB.NET

"Rastarizer" wrote:
I got an OEM file and I use a StreamReader to read it but I got a problem
that the file may got some characters that StreamReader can not read so it
reads only some data of it.

eg.

Dim StreamToDisplay As New StreamReader("C:\OEMFILE.DAT", _
Encoding.GetEncoding(CultureInfo.CurrentCulture.Te xtInfo.OEMCodePage))
Dim aLine As String
Do
aLine = StreamToDisplay.ReadLine
TextBox1.Text += aLine + Chr(13) + Chr(10)
Loop Until aLine = Nothing
StreamToDisplay.Close()

When it ends then I see at the TextBox that the file is has not be read
right. I tried the FileOpen method but the same problem occured.
The encoding is correct cause when I open the OEMFILE.DAT through the
Notepad and simple save it with the same name then the StreamReader can read
it correct. But the point is that it must be done without the help of the
Notepad.

Any help ?

Nov 21 '05 #2

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

Similar topics

0
by: Eric Myers | last post by:
Hello folks: (This message is also posted on the help forum at the pexpect sourceforge page, but all indentation in the code got stripped away when I submitted the post.) For some time I've...
100
by: Roose | last post by:
Just to make a tangential point here, in case anyone new to C doesn't understand what all these flame wars are about. Shorthand title: "My boss would fire me if I wrote 100% ANSI C code" We...
4
by: Luke Wu | last post by:
I am just wondering what the following terms usually mean: 1) "Standard C" 2) "K&R C" 3) "ANSI C" I am pretty sure "ANSI C" usually refers to the C89 standard, but what
83
by: sunny | last post by:
Hi All What is C99 Standard is all about. is it portable, i mean i saw -std=C99 option in GCC but there is no such thing in VC++.? which one is better ANSI C / C99? can i know the major...
7
by: Paul Connolly | last post by:
char *s = "Hello"; s = 'J'; puts(s); might print "Jello" in a pre-ANSI compiler - is the behaviour of this program undefined in any pre-ANSI compiler - or would it always have printed "Jello"...
127
by: bz800k | last post by:
Hi Does this code satisfy ANSI C syntax ? void function(void) { int a = 2; a = ({int c; c = a + 2;}); /* <<-- here !! */ printf("a=%d\n", a);
0
NeoPa
by: NeoPa | last post by:
ANSI-89 v ANSI-92 Before we get into all the various types of pattern matching that can be used, there are two ANSI standards used for the main types of wildcard matching (matching zero or more...
41
by: jaysome | last post by:
It's been almost eight years since ISO/IEC approved ISO/IEC 9899:1999. Does anyone know if ANSI has approved it? A Google search shows arguably confusing answers as to whether ANSI has...
8
AmberJain
by: AmberJain | last post by:
HELLO, Is it necessary for a C programmer to have an ANSI C standard or it's sufficient to own Kernigham and Rithie's The C programming language? I know that the ritchie's book is quite brief...
6
by: Peng Yu | last post by:
Hi, ANSI and GNU C are different in some delicate aspects (I'm not sure about C++). For example, M_PI is not in ANSI C but in GNU C. Of course, to make my program most portable, I should go...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.