Questions tagged [binarywriter]
170 questions
0
votes
1 answer
c# write binary from textbox
How can i write binary that was changed from textbox input. I have a decimal to binary converter but WriteByte does not allow me to use textbox. it gives me an error that i don't know what it means.
instead 0xFF. i want to put custom values 0 to…
user3763113
0
votes
1 answer
Hooking into a BinaryWriter's Dispose
I would like to make writing more comfortable for a user of my class by offering them a BinaryWriter that, upon disposal, automatically adds its data to some internal queue.
For this purpose, I would like to write a subclass of BinaryWriter and…

mafu
- 31,798
- 42
- 154
- 247
0
votes
1 answer
Read binary data (image) from separated file
I have a file which has records for employees data and images. Each record for one employee and his data, his image, and his wife image. I can't change the file structure
There are separators between text data and images.
Here a sample of one…

404_File_Not_Found
- 11
- 3
0
votes
1 answer
Writing to MemoryStream from BinaryReader
i am having an issue when trying to read saved List from binary file back to a List.
the file is encrypted, without encryption i had no problem.
writing method:
private void WriteEncodedFile(FileStream fileStream, MemoryStream memoryStream)
{
…

TTomer
- 356
- 2
- 11
0
votes
1 answer
Unable to read beyond the end of the stream 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
0
votes
1 answer
System.IO - Does BinaryReader/Writer read/write exactly what a file contains? (abstract concept)
I'm relatively new to C# and am attempting to adapt a text encryption algorithm I designed in wxMaxima into a Binary encryption program in C# using Visual Studio forms. Because I am new to reading/writing binary files, I am lacking in knowledge…

ThisHandleNotInUse
- 1,135
- 1
- 10
- 23
0
votes
1 answer
Writing binary data to ftp location
How come this code writes an empty file at given location?
No error messages.
// upload file
WebRequest upload = WebRequest.Create(ftp + path + "/" + file);
upload.Method = WebRequestMethods.Ftp.UploadFile;
upload.Credentials = new…

Gravity123
- 1,130
- 3
- 21
- 39
0
votes
3 answers
Clear binarywriter with memorystream
I´ve a binarywriter with a memorystream, and I need to clear it if one condition happens:
public void Execute() {
MemoryStream memoryStream = new MemoryStream();
BinaryWriter writer = new BinaryWriter(memoryStream);
Log log = new…

Alberto
- 704
- 2
- 12
- 26
0
votes
3 answers
How BinaryWriter in c# saves its content?
created a binary file by using c#: The code I used was this
try
{
Console.WriteLine("Binary Writer");
using (BinaryWriter b = new BinaryWriter(File.Open("C:\\file.bin",FileMode.Create)))
{
…

Aada
- 1,591
- 7
- 30
- 57
0
votes
3 answers
Read and write in c#
I want to read a file(image) and another file video in c# and save(write) all the contents of both files(1 after another) in single txt file.Now i want to again retrieve the first image file content and second file content separately. Is it possible…

Rathindra Singha
- 19
- 3
0
votes
1 answer
GetByteCount shows up negative, but it's not
so i am trying to get ByteCount from a litview subitem, but it always shows up negative error:
[Argument OutOfRangeException was unhandled: 'count' mustn't be negative, Parameter name: count]
this is the code line i get the error…

Omarrrio
- 1,075
- 1
- 16
- 34
0
votes
2 answers
How to download file from System.Web.HttpContext.Current.Response.BinaryWrite(byteArray); from javascript instead of C#
I have a C# method that works if you call it from another C# method, but not from javascript. How do I make it work from my ajax call?
I need to get a file based on an ID that is passed in, so I have an ajax post with the statusID. That ID is…

codesforcoffee
- 179
- 5
- 11
0
votes
1 answer
Write empty bytes using binarywriter
so i am using binarywriter to write some strings over the original strings, but i need to overwrite the whole string in the binary file, so i am trying to write the new string, and overwrite the rest of the old string with 0x00 (empty bytes), this…

Omarrrio
- 1,075
- 1
- 16
- 34
0
votes
1 answer
Strange behavior with BinaryWriter and MemoryStream in C#
I have a class with the following method:
public System.IO.Stream ToBinary ()
{
int length = 4144;
System.IO.Stream stream = null;
System.IO.BinaryWriter writer = null;
stream = new System.IO.MemoryStream(length);
writer = new…

Raheel Khan
- 14,205
- 13
- 80
- 168
0
votes
1 answer
How does changing the position of the BaseStream of a BinaryReader affect the current state of a BinaryWriter that uses the same BaseStream?
I am working on a parser that watches a stream (probably from a NetworkStream). When certain data is seen on the source stream, a new MemoryStream is created and the relevant data from the source is written to it.
Then I pass the MemoryStream for…

Rich Shealer
- 3,362
- 1
- 34
- 59