Questions tagged [binarywriter]
170 questions
0
votes
0 answers
Serialize non-primitive objects using BinaryWriter
I would like to use the System.IO.BinaryWriter to serialize data structure with non-primitive fields\properties.
I know that this serializer can work only with primitive types, so I need to "dig-in" into each object.
I assumed that the BinaryWriter…

Guy E
- 1,775
- 2
- 27
- 55
0
votes
0 answers
Why I am not able to get the data back which I have saved to dat file using BinaryReader in C#? How to Implement this properly using BinaryReader?
I have created a Class with constructor in which I pass the parameters as studentName, studentMarks & avgMarks and use Constructor to set the values and inside WriteData() method I use BinaryWriter to write the data to stud.dat file and after that I…

Swapnil Nawale
- 21
- 2
0
votes
0 answers
Exporting multiple blob records and saving to disk
I have a table in sql storing blob data (varbinary(max)) that I need to export as separate file in directories. The code I below selects all of the records and creates directories and stores the file. However, all the files are zero bytes. I need…

rednelo
- 3
- 3
0
votes
1 answer
SharePoint ashx handler file download Problem
I have a ashx handler that gets a file we are using, this in SharePoint, and then it checks what kind of file it is and then it writes using Response.BinaryWrite. It get this file from another server, that contains all of our files. When I go to…

atrljoe
- 8,031
- 11
- 67
- 110
0
votes
1 answer
What is the equivalent of BinaryWriter.Write() from C# in Python?
So I have this function in a C# program:
public void Write(BinaryWriter writer)
{
writer.Write(0x6369676F6C6572uL | ((ulong)Type << 56));
writer.Write(Revision);
writer.Write((ulong)(int)((uint)IsFavorite.ToInt() & 1u));
…

user8453965
- 11
- 4
0
votes
0 answers
Does ADODB.Stream chunks conflicts with Response.Buffer?
I use the follwoing code to push a large ZIP file to the client using vbscript (Classic asp). I am not sure how objStream.Read(10240) works? Does it send data to the client in chunks (or loads the file in memory chunks)? Should I also use…

Ali Sheikhpour
- 10,475
- 5
- 41
- 82
0
votes
1 answer
Converting XLS to PDF: Getting "Data index must be a valid index in the field" exception during GetBytes()
I have an application that converts files into PDF. It first saves a blob from MySQL into a temp file and then it converts that temp file into a PDF. I'm getting this "Data index must be a valid index in the field" exception error at the GetBytes()…

E. Choi
- 1,575
- 3
- 8
- 8
0
votes
1 answer
How to determine how many bytes a BinaryWriter would take to write into memory?
I red: How many bytes will a string take up? and How to know the size of the string in bytes? and some others but I can't figure out the exact count of bytes that a string will take into memory using a BinaryWriter over a MemoryMappedViewStream over…

Eric Ouellet
- 10,996
- 11
- 84
- 119
0
votes
1 answer
C# BinaryWriter/BinaryReader - Reader order doesn't match write order
I have some voxel data I would like to save using BinaryWriter and then read using BinaryReader but I'm encountering some issues.
When I read it again, it seems like the data is in a different order and thus, my resulting voxel chunks get the wrong…

Hertzole
- 73
- 8
0
votes
1 answer
Huffman codes. Decompression stage. How to extract byte array(or byte-by-byte) from file .bin in a list which will be an 8-bit array
I'm trying to implement Huffman compression and decompression of .txt file. Compression works fine: in brief, I build binary tree where symbols are leafs, encode each symbol with List of 0's and 1's, form a long string of that 0's and 1's for…

paulokunev
- 155
- 1
- 1
- 8
0
votes
2 answers
Read and write from/to the same line with BinaryReader/BinaryWriter
I want to read a binary file line by line (I'm writing of course continously, but I know that after 457 bytes new data start and I know exactly the byte structure and where which information is written to) and change a special entry of the line. I…

purbsel
- 307
- 8
- 21
0
votes
0 answers
How to remove Byte Order Mask from utf-8 BinaryWriter?
I am generating CSV file which contains double byte characters. Right now I am using BinaryWriter with UTF-8 encoding. Problem is that generated CSV file has BOM prefix(preamble). How can I remove the preamble?
I am adding preamble to BinaryWriter…

Frosty Bacon
- 61
- 8
0
votes
0 answers
How to replace hex without a binary writer
I need to replace a bit of text string in a hex file. I have already used a binary writer but as i add more stuff to the file, the offsets change. Therefore I have to keep fixing the offsets.
I have already tried the binary writer…

Terry
- 1
- 2
0
votes
2 answers
Efficiently writing an int array to file
I have a potentially larger int array that I'm writing to a file using BinaryWriter. Of course, I can use the default approach.
using (BinaryWriter writer = new BinaryWriter(File.Open(path, FileMode.Create)))
{
writer.Write(myIntArray.Length);
…

Jonathan Wood
- 65,341
- 71
- 269
- 466
0
votes
1 answer
C# binarywriter start and end of string
Im sending a large string 0.443+0.064+-0.120+-0.886+0.15167+-0.26754+0.95153 over a TCP socket-connection.
The message i recieve is not similar to the string i send. It is cut at random points, i.e. 43+0.064+-0.120+-0.886+0.15167+-0.26754+0
How can…

pvand
- 103
- 1
- 10