Hi sharpies,
Quick question. I have a file with 4 column data with line terminating
with CRLF.
name~age~data~month
Where the data is binary data. Most of the time it will be .... (binary
value of FFFFFFF). When I used the stream reader, it read all the
records correctly (used readline). But the problem is, it doesn't put
my data field with actual data, instead it put empty data. So if I have
a row
dbc~34~......~3 (Where .... binary value is FFFFFFFFF)
the program reads in dbc~34~~3.
Does anyone know why stream reader is skipping that value? I haven't
tried with binary reader yet. I will try, but just curious why
streamreader doesn't like the value.
Thanks/
DBC User 3 14902
"DBC User" <ks*****@gmail.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com... Hi sharpies,
Quick question. I have a file with 4 column data with line terminating with CRLF.
name~age~data~month
Where the data is binary data. Most of the time it will be .... (binary value of FFFFFFF). When I used the stream reader, it read all the records correctly (used readline). But the problem is, it doesn't put my data field with actual data, instead it put empty data. So if I have a row
dbc~34~......~3 (Where .... binary value is FFFFFFFFF)
the program reads in dbc~34~~3.
Does anyone know why stream reader is skipping that value? I haven't tried with binary reader yet. I will try, but just curious why streamreader doesn't like the value.
You can't have a lines terminated by CRLF and binary data. What if 0xDA
appears in the binary data?
For such a file, just open a FileStream and handle it yourself.
David
Thanks but my question is "is there a reason, why Streamreader is
skipping the data?" I got it working with binarystream.
DBC User <ks*****@gmail.com> wrote: Hi sharpies,
Quick question. I have a file with 4 column data with line terminating with CRLF.
name~age~data~month
Where the data is binary data. Most of the time it will be .... (binary value of FFFFFFF). When I used the stream reader, it read all the records correctly (used readline). But the problem is, it doesn't put my data field with actual data, instead it put empty data. So if I have a row
dbc~34~......~3 (Where .... binary value is FFFFFFFFF)
the program reads in dbc~34~~3.
Does anyone know why stream reader is skipping that value? I haven't tried with binary reader yet. I will try, but just curious why streamreader doesn't like the value.
StreamReaders are meant for reading text data, not binary data.
Depending on which encoding is being used, StreamReader is likely to be
reading *something*, but it may be unprintable. Which encoding are you
using?
--
Jon Skeet - <sk***@pobox.com> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: alien |
last post by:
Hi, I'm using a StreamReader (readLine()) to read text from a file, but some
lines in the file I'm reading have odd characters, such as the Euro symbol,
etc. I find that no matter what encoding I...
|
by: Question with BinaryReader |
last post by:
I use BinaryReader to read my binary dafa files, when i call ReadBytes, why
it always return more 4 bytes. The following is my code.
FileStream fs = new FileStream(file, FileMode.OpenOrCreate,...
|
by: David Buchan |
last post by:
Hello,
I wonder if anyone could help me.
I'm using vb.NET and I'd like to read a binary file, byte by byte, and
then write to another file (making a duplicate, identical file).
I'd then...
|
by: vvenk |
last post by:
Hello:
When I use either one to read a Text file, I get the same result. The length
of the string that the file's content has been written into is the same.
However, if the file is binary,...
|
by: Fred Nelson |
last post by:
Hi:
I'm writing a VB.NET web application where I would like to upload an image
file from the user's computer and either insert it into a database as a BLOB
or save it as a file in a directory...
| |
by: Jack Russell |
last post by:
I have the following code in VB.net 2003
Dim s As String
Dim sr As StreamReader = New StreamReader("test.txt", New
UTF7Encoding)
s = sr.ReadLine
Debug.Write(s)
If the string read is 1+.03...
|
by: Mike R |
last post by:
Hi All,
I'm trying to read a file that has the following format, its a variable
record file, the first byte determines how to process the rest.
byte 1 = either 0,1,2,3
4 bytes = size of the...
|
by: Zytan |
last post by:
I have installed the Visual C# 2005 Code Snippets, and the snippets
for file handling use StreamReader and StreamWriter, instead of
System.IO.File.*. VB 2005 code snippets don't use these. Why...
|
by: Tony Johansson |
last post by:
Hello!
I just wonder in this specific case is it any advantage to use a
TextReader a reference to a StreamReader ?
Try
{
TextReader tr = new StreamReader(locationTextBox.Text);
Try
{
|
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,...
|
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...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |