Questions tagged [binaryreader]

In .net is a class used to read binary values. In general, it is a class or a program to read and manipulate binary data.

244 questions
0
votes
2 answers

Reading UInt16 numbers only binary file

If I were reading byte numbers I would do: using (FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) { int size = (int) stream.Length; BinaryReader br = new BinaryReader(stream); byte[] test = new byte[size]; …
Smash
  • 3,722
  • 4
  • 34
  • 54
0
votes
2 answers

BinaryReader and BinaryWriter file handle in Delphi Prism

I want to be able to read and write into a file in the same instance or through same file handle. What I mean is this. Say you open a file as follows. BinaryReader jfile := new BinaryReader(File.OpenRead('c:\jokes.dat')); I want to be able to also…
ThN
  • 3,235
  • 3
  • 57
  • 115
-1
votes
1 answer

Is it possible to detect if BinaryReader.ReadBytes(int) reaches the end of a stream?

Most of BinaryReader's read methods throw an EndOfStreamException if it reaches the end of a stream, but strangely the ReadBytes method doesn't. But what if I do still want to throw an EndOfStreamException? How do I detect that? I could use the…
JochCool
  • 23
  • 6
-1
votes
1 answer

C# binary writer and reader

Problem that I am having is : I am reading a array of bytes using binary reader to construct a windows gui for editing of a file, for instance I am reading the following byte array: 123cbb75 //read the first 4 bytes from 0x36A2 byte[] buffer =…
celtics33
  • 15
  • 6
-1
votes
1 answer

C# SQL Server CE binary data recovery

I am trying to save and read back pdf files in a SQL Server CE local database. I was able to save them as binary data in an Image column, but I don't know how to read them back and open the pdf file (original format). Table Schema Here is how I…
Anahoua16
  • 115
  • 1
  • 1
  • 4
-1
votes
1 answer

How to Load Binary File Into Struct and get the data?

I'm done searching any topic on stackoverflow to solving my problem, but i still can't solving my problem with my code I want to reading binary file using c# , and make a struct for it here is the code [StructLayout(LayoutKind.Explicit, CharSet…
Bayu Anggara
  • 99
  • 3
  • 12
-1
votes
2 answers

Binary Writer/Reader extra character

I am converting some legacy VB6 code to C# and this just has me a little baffled. The VB6 code wrote certain data sequentially to a file. This data is always 110 bytes. I can read this file just fine in the converted code, but I'm having trouble…
Calix
  • 1
  • 3
-1
votes
1 answer

How to use BinaryReader class to read a custom file (C++) using C#?

Okay, so, for a personal project I've been given the task to code a tool to make use of a custom file that was serialized from C++ using C#. I thought of using BinaryReader class and effectively that was the right path but as I suspected I couldn't…
n3hl
  • 87
  • 1
  • 12
-1
votes
1 answer

How to point to the particular index of BinaryStream?

I have a byte array consist of 32 bytes. I want to read 4 bytes from index position 16 to 19. How can i point binary reader to start reading from index 16. I am trying these commands byte[] trace ; // 32 byte array using (FileStream s =…
omar000
  • 3
  • 3
-1
votes
1 answer

How to Read from a Section of a File?

I'm trying to read from a section of this file that had a payload stored to it when being dumped from the Xbox. What I'm trying to do is read from where the payload is and if it equals to all 0's then change a label to saying No. I knew I am…
-1
votes
3 answers

BinaryReader or Writer.Close() is not closing properly C#

I have a form application that performs a simulation and constantly reads/writes a binary file. Everything works fine if you let it run through. However, if the form is closed/ the simulation is aborted the file-stream is not closed properly -…
timkado
  • 1,922
  • 2
  • 17
  • 27
-2
votes
2 answers

Binary Reader problems

When I run my program the code below comes up with an error: ///////////////////////////// Read in the selected ////////////// BinaryReader br2 = new BinaryReader(File.OpenRead(directoryToSearch2), …
user826436
  • 231
  • 1
  • 4
  • 14
-2
votes
1 answer

Reading IBM floating-point in C++

I have a a binary file format with a bunch of headers and floating point data. I am working on a code that parses the binary file. Reading the headers was not hard but when I tried to read the data I ran into some difficulties. I opened the file and…
timko.mate
  • 364
  • 1
  • 3
  • 13
-2
votes
1 answer

converting image into byte[] asp.net mvc

I need to store the image in my database in byte[] I am sending the image from Javascript to mvc controller using ajax In my javascript var files = $("#MyImage").get(0).files; formData.append('files', files); in my MVC Controller using (var…
user6656728
-2
votes
1 answer

BinaryReader - reading returns 1 record instead of multiple records

I am using BinaryWriter to write data to a log file. However when I use BinaryReader to retrieve the data (within a loop), I am able to read the first 3 writes (integer, integer, byte[]), but the next iteration in the loop to read another 3 just…
Radiohead
  • 89
  • 13
1 2 3
16
17