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
1 answer

BinaryReader Misalignment - Not reading correct amount of bytes

I'm writing a program that is loading and extracting files from an archive. Currently with my code it is successfully extracting one of the archives I need, and with the problem archive, it reads and extracts 6 files before giving an exception. The…
Dan McCarthy
  • 23
  • 1
  • 5
0
votes
1 answer

Efficiency in BinaryReader.ReadUInt64()

I was just trying to optimize some code when I came across this code in the .NET BinaryReader class: [CLSCompliant(false)] [__DynamicallyInvokable] public virtual ulong ReadUInt64() { this.FillBuffer(8); return (ulong) (uint) ((int)…
Hele
  • 1,558
  • 4
  • 23
  • 39
0
votes
2 answers

Why my 2 bytes (0x00 0x40) that should be 64 produce 16384 instead?

Please see this file using Hex Editor: I am reading the 2 bytes this way: BinaryReader binaryReader; int wlen = binaryReader.ReadUInt16(); When I read this 2 bytes my BinaryReader.BaseStream.Position is 14 but wlen = 16384 and this should be 64.…
david hol
  • 1,272
  • 7
  • 22
  • 44
0
votes
1 answer

Read binary file position by position and convert it?

I Know on VB we can read binary file using this code Function GetMonData() Dim Header(63) As Byte, Rows As Long, NoUse As Long Dim i As Long, j As Long, TmpStr As String Open "file.dat" For Binary As #1 …
Bayu Anggara
  • 99
  • 3
  • 12
0
votes
0 answers

How to read a file and store in buffer with optimization

I have a large file containing strings. I have to read this file and store it in a buffer using C or C++. I tried to do it as follows: FILE* file = fopen(fileName.c_str(), "r"); assert(file != NULL); size_t BUF_SIZE = 10 * 1024 * 1024; char* buf =…
xav xav
  • 231
  • 2
  • 5
  • 12
0
votes
0 answers

rows in matrix swapped when storing into bin file

I'm saving a matrix of data into a bin file, and SOME TIMES (that's the weird part) it swaps the last row and it appears as the 3rd row, or 4th row. Not consistent. The system runs in real time storing data from an amplifier. The amp send packages…
javirs
  • 1,049
  • 26
  • 52
0
votes
1 answer

C# error on reading mp3 file by binary reader : The process cannot access the file 'URL\testbinary.mp3' because it is being used by another process

hiiii, i want to read mp3 file by using binary reader, my code is : using (BinaryReader br = new BinaryReader(File.Open("Songs/testbinary.mp3", FileMode.Open))) { int length = (int)br.BaseStream.Length; byte[]…
Deepak
  • 178
  • 1
  • 2
  • 14
0
votes
1 answer

Finding HEX value at a specific offset in VB.net

I'm trying to figure out how to read a section of bytes (Say 16) starting at a specific address, say 0x2050. I'd like to get the 16 bits output in hex values into a label. I've been trying to figure out BinaryReader, and FileStreams but I'm not…
level42
  • 946
  • 2
  • 13
  • 33
0
votes
2 answers

Simple binary reader-writer code not working

MS VS 2010, XNA 4.0 So, I have a class Planet & it has Save and Load functions. public void SaveToFile(ContentManager content) { string path = content.RootDirectory + @"\Objects\Planets\" + this.name +@".planet"; using…
Monset
  • 648
  • 5
  • 25
0
votes
2 answers

Cannot access closed file during Reading/Writing operation - C#

I have searched the internet and viewed many posts, but none has helped me. So I decided to ask my own question over here. I am writing some data to binary file when the save button on my form is clicked, and reading that data from the file when the…
0
votes
2 answers

Clone read bytes of BinaryReader

I'm using a BinaryReader to parse certain data. I would like to copy the read bytes to a secondary stream. How can I do that? If I derive from BinaryReader (I need to do that for a different reason anyway, actually), which methods do I need to…
mafu
  • 31,798
  • 42
  • 154
  • 247
0
votes
1 answer

Can I use progressbar in parallel? (every thread reads a different file)

I have to deal with like 10 binary files, each larger than 100MB. I have written a single thread program using BinaryReader, and it worked well. I want to make it parallel by using Parallel.For(0,10, i=> { ------------- BinaryReader BR = new…
0
votes
0 answers

Tcpclient binaryreader not receiving a specific packet C#

So let me make this clear, I'm quite new to packets and networking. So I'm working on a project where there'll be 1 server and 4 clients all connected to the server. I've gotten most of my packets working, both sides but I've gotten problems with…
0
votes
3 answers

C# Using BinaryReader to read color byte values of a bitmap image

I am using BinaryReader to read the bytes of an image, I am having some issues trying to read the ARGB values of a bitmap image using BinaryReader. Can anyone suggest a way I could get the byte value for each pixel in a bitmap image? Thanks in…
Conor Shannon
  • 439
  • 2
  • 6
  • 17
0
votes
0 answers

Read Rijndael encrypted file in memory itself to decrypt

I have a file which is encrypted using Rijndael encryption method. I want to decrypt in memory itself, instead of writing it to disk. So I tried using BinaryReader to read the file. But how to use BinaryReader and read the binary file so that i can…
IT researcher
  • 3,274
  • 17
  • 79
  • 143