Questions tagged [binarywriter]
170 questions
1
vote
0 answers
Entered values of datagrid are different than from a textfile
I need some insight about the following case.
I have written a program which reads japanese characters (Encoding 932).
When they are displayed in the Data Grid, there is an option to change the values, entering standard ASCII characters.
Next…

Insight
- 196
- 1
- 13
1
vote
1 answer
Changing sequence of BinaryReader after software release
I am using a Unity3D serialization tool that uses BinaryReader and Writer.
Saving players game state with this tool. The disadvantage of sequential reading and writing is you must read that file in same order evertime.
When i want to add new…

Lordinarius
- 11
- 1
1
vote
1 answer
Open a PDF in new tab from URL from my MVC Controller [EDITED]
In my view, I generate a link with a username, acct number and date that is passed to the controller:
@Html.ActionLink(AccountGroup.AcctNum + " " + AccountGroup.DocDate.ToShortDateString(), "GetIndividualStatement", "Statements", new {…

Danimal111
- 1,976
- 25
- 31
1
vote
2 answers
Problems with writing bytes format of string data in Text File in C#
I have a text file stored locally. I want to store string data in binary format there and then retrieve the data again. In the following code snippet, I have done the conversion.
using System;
using System.Collections.Generic;
using System.IO;
using…

lukai
- 536
- 1
- 5
- 20
1
vote
1 answer
how can i modify a small section of bytes in a memory stream, that was written to using binarywriter
how do i edit the first four bytes in memory stream? Imagine "bytes" in the following code is a few 100 bytes long. i need to write a place holder of say, 4 bytes of value 0 and come back and update those bytes to new values.
static MemoryStream…

netnoob
- 23
- 6
1
vote
1 answer
Reusing Streams in a UDP Server
I'm writing a UDP server and am wanting to reduce the number of allocations that are taking place per incoming and outgoing datagram packets. One of the things I'd like to do is re-use the Streams I'm allocating to read and write my datagram…

Johnathon Sullinger
- 7,097
- 5
- 37
- 102
1
vote
1 answer
Number of Elements in a Binary File
I'm reading in a binary file, and I would like to know the number of elements of a custom object, the binary file contains (which makes searching for the EOF with size useless, because its all about the number of elements).
This is what I'm doing…

John
- 447
- 2
- 8
- 20
1
vote
2 answers
Using BinaryReader/BinaryWriter to build a chat
Hello I'm trying to build a chat using BinaryReader/BinaryWriter, I came into a dead end where I can't figure out how do I make my server send the message to all connected clients..
I have tried adding all clients to a list and running foreach loop…

alentor
- 27
- 3
- 12
1
vote
2 answers
Out of memory using BinaryWriter in C# on adding files to a zip file
I am trying to add files to a Zip file, preserving the directory. The code below is basically working as long as I do not have files of a few 100 Mb to zip. If I just zip a directory with 1 file of about 250 Mb (on a system with plenty of memory…

Dick
- 433
- 5
- 13
1
vote
1 answer
How do I close the filestream after creating a file or otherwise create access to the newly created file?
I'm saving a canvas image to the server using FileStream. It works fine the first time, but if the user visits the page again during the same session (without closing the browser) it throws the error "The process cannot access the file…

boilers222
- 1,901
- 7
- 33
- 71
1
vote
1 answer
Send Specific Values to BinaryWriter
i need help here, i did run out of ideas.
I need to do in the following code, to be able to chose a file from within the project (My.resources), instead of HardCoding this line
FSR.Write(My.Resources._1_5, 0, My.Resources._1_5.Length)
i would…

JavierM
- 11
- 2
1
vote
2 answers
Excel 2007 file writer in C# results in a corrupt file
I am using a BinaryReader to read an Excel 2007 file from an Exchange mailbox using a OWA, the file is then written to disk using a BinaryWriter. My problem is that the two files don't match when the writer finishes. Worse still Excel 2007 won't…

Martin
- 31
- 3
1
vote
2 answers
Stream was not readable is caused when use readbinary
I am trying to send a value by socket .So i have two parts in my project Client and server .
The client sends a value to server using this code :
NetworkStream networkStream = socketForServer.GetStream();
System.IO.BinaryWriter…

Ehsan Akbar
- 6,977
- 19
- 96
- 180
1
vote
1 answer
Buffering Audio Streams in Windows Phone 8
I am working on a Internet radio streaming application for Windows Phone. I am researching the best-practices and different implementations. I am using the following code to read the stream:
private MemoryStream bufferStream;
private Stream…

burakk
- 1,231
- 2
- 22
- 45
1
vote
1 answer
The correct way to create Binary files in C#
I'm using the below code to create a Binary file.
var a = new[]
{
"C50-12-25",
"C50-12-20"
};
using (var bw = new BinaryWriter(File.Open("file.bin", FileMode.Create)))
{
foreach (var i in a)
{
bw.Write(i);
}
}
I opened…

Vahid
- 5,144
- 13
- 70
- 146