Questions tagged [binarywriter]
170 questions
-1
votes
1 answer
How could this be shortened?
I have this piece of code right here:
public void SendID(int id)
{
try
{
binaryWriter.Write((int)Command.ID);
// part differening each time
binaryWriter.Write(id);
// end of part differing each time
}
…

hl2mukkel
- 118
- 5
-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
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
-2
votes
2 answers
Receive byte array from server to client? BinaryReader / BinaryWriter error?
Hi i'm a newbie in c# and doing server and client for sharing text file via tcp/ip socket connection. I used the BinaryReader / BinaryWriter to upload from client to server but stucking from server to client:
From client to server:
Socket clientSock…

Cao Linh Truong
- 253
- 8
- 20
-3
votes
1 answer
Convert Array of "true,false or 0,1" to byte array then write it as a file
I'm asking a simple question but i can't find the easiest way to do that, my application read a small file, Simply the 8 bytes word "uploaded" read from just 8 byte file, will be a binary array of 0,1... or list of true-false and the length is 8*8=…

Joe Marcel
- 1
- 2