Questions tagged [binarywriter]
170 questions
2
votes
1 answer
BinaryWriter for 64bit files alternatives?
BinaryWriter - unable to perform Seek on 64bit values.
Parameter passed to the function Seek (int32)
Is there a similar class for files larger than 2 Gb?

Mixer
- 1,292
- 3
- 22
- 41
2
votes
3 answers
I'd like to use ifstream and ofstream in C++ to mimic C#'s BinaryReader / BinaryWriter functionality
I'm looking for a way to write floats/ints/strings to a file and read them as floats/ints/strings. (basically read/write as ios::binary).

KBog
- 3,800
- 1
- 25
- 31
2
votes
1 answer
Reading/Writing unsigned bytes with std::stringstream
I am trying to write unsigned chars to a stringstream.
The information I need to write has 0x00 involved. I need to be writing the values 0 thru 40 as actual numeric values, and not as ASCII characters.
EDIT: To clarify, I am writing more than just…

user1792208
- 21
- 1
- 3
2
votes
1 answer
BinaryWriter Unusual hex
I got some problem transfering Data via the BinaryWriter.
When I try to send
bw.Write(0x1a);
bw.Write(0xf8);
bw.Write(0x05);
It gets in the output to 0x00 - via
Client2Server._mainSock.Send(ms.ToArray());
What is causing this problem?
Greetings

Moritz
- 153
- 1
- 9
2
votes
4 answers
Write one single bit to binary file using BinaryWriter
I want to write one single bit to a binary file.
using (FileStream fileStream = new FileStream(@"myfile.bin", FileMode.Create))
using (BinaryWriter binaryWriter = new BinaryWriter(fileStream))
{
binaryWriter.Write((bool)10);
}
Something like…

Hlavson
- 309
- 1
- 7
- 14
1
vote
1 answer
BinaryWriter not writing to file and I can't figure out why
I'm having trouble and I think it's because I'm doing something wrong with BinaryWriter. In essence, I'm trying to write over an existing group of images and text strings in a file using BinaryWriter. The code functions and there's no complaints,…

TrojanNemo
- 7
- 3
1
vote
0 answers
Need for a fast writing of binary data to a file
I receive a fair amount of binary data from an external device, about 30-40 MB/s. I need to save it to a file. On the external source device side, I have a very small buffer that I can't enlarge and as soon as the transmission stutters on the C#…

bLAZ
- 1,689
- 4
- 19
- 31
1
vote
2 answers
How to read and write "SET OF" type into a file using BinaryWriter?
This is for Delphi Prism.
Say, I have the following enum SET type that I would like to save into a binary file.
Fruit = (Apple, Banana, Mango, Cherry, Grapes, BlueBerry);
Fruits = set of Fruit;
FruitBasket:Fruits;
with Fruit do
FruitBasket :=…

ThN
- 3,235
- 3
- 57
- 115
1
vote
2 answers
Delphi Prism: Does BinaryWriter "Write method" work the same as Writeln method from Delphi?
I am working with Delphi Prism and creating and writing into binary file using BinaryWriter as follows.
method TUnit.Write(bw:BinaryWriter);
var
i:Integer;
begin
bw.write(ord(uType));
bw.Write(ord(State));
bw.Write(Address);
…

ThN
- 3,235
- 3
- 57
- 115
1
vote
3 answers
How to save a char[25] when it contains only 6 chars C#
I have a class that contains as follow
public class foo
{
public long id= 0;
public char[] TestId = new char[25];// new char[25];
public char[] GUID = new char[64]; //new char[64];
public char[] sign = new char[61];//new char[61];
…

Jean-Marc
- 21
- 4
1
vote
0 answers
How do I embed Assembly Info into a file created by a C# program
I'm working on a program, in C#, that uses both a System.IO.BinaryWriter and a System.IO.Streamwriter to create two datafiles.
I know how to retrieve/set the Assembly of my C# program.
What I'd like to do, is embed my C# program's assembly…

Annalisa Seubert
- 11
- 2
1
vote
2 answers
BinaryWriter Incorrectly writing two bytes extra C#
Firstly, here is my method to write to my specified offsets, I've went through the debugging process and everything is getting set accordingly.
Example, I've set the pokemonValue to 190 it is then converted to 0xBE and then written to the offset at…

David
- 21
- 6
1
vote
3 answers
Store the state inside golang binary
I am Developing an onpremise solution for a client without any control and internet connection on the machine.
The solution is to be monetized based on number of allowed requests(REST API calls) for a bought license. So currently we store the…

ashishmohite
- 1,120
- 6
- 14
1
vote
2 answers
How to generate a binary file? C#
I need to make a method that generates a binary (4 bytes long), receives List of integers and writes this List one by one in the file. So, I have this:
public void FrameCodesBinaryWriter(List frameCodes)
{
using (FileStream fileStream =…

ale
- 3,301
- 10
- 40
- 48
1
vote
2 answers
Replacing byte in file
I'm trying to replace certain bytes from a file with some other specific bytes, but have a problem with my binary writer replacing too many bytes. What is wrong in my code?
using (BinaryWriter bw =
new BinaryWriter(File.Open(fileName,
…

Seregon85
- 13
- 3