Questions tagged [binarywriter]

170 questions
0
votes
1 answer

8 bytes of data being written to file by an empty method

I've been messing around with the save code of a game that resides in a dll and have discovered something interesting. I'm using ILSpy with Reflexil to read and alter the code of the dll. Okay, I have the following snippet of code (as shown by…
Karlovsky120
  • 6,212
  • 8
  • 41
  • 94
0
votes
1 answer

Seeking a particular value when using BinaryWriter

I find it difficult to express myself so I'll jump right into the code FileStream stream = new FileStream("//ignoreThis//demo.bin", FileMode.Append, FileAccess.Write, FileShare.Write)); BinaryWriter writer = new…
Gabriel Stellini
  • 426
  • 4
  • 13
0
votes
2 answers

binarywriter not opening file at end of stream

I have a method which uses a binarywriter to write a record consisting of few uints and a byte array to a file. This method executes about a dozen times a second as part of my program. The code is below: iLogFileMutex.WaitOne(); using (BinaryWriter…
CalumMcCall
  • 1,665
  • 4
  • 24
  • 46
0
votes
0 answers

rows in matrix swapped when storing into bin file

I'm saving a matrix of data into a bin file, and SOME TIMES (that's the weird part) it swaps the last row and it appears as the 3rd row, or 4th row. Not consistent. The system runs in real time storing data from an amplifier. The amp send packages…
javirs
  • 1,049
  • 26
  • 52
0
votes
1 answer

C# binary writer ushort bytes order

I have a server side app written in D and my client app is written in C#. I use BinaryWriter for communication between them but I have a problem with the byte order. Actually the order of bytes is not the same, example : C# Client: MemoryStream ms =…
Adwelean
  • 47
  • 11
0
votes
0 answers

Effecient way to serialize jagged arrays using BinaryWriter

stackoverflowers. I am basically wondering if anyone has got a tip on how I should go on about this. I am already serializing regular primitive types using the BinaryWriter (by length prefixing byte arrays). Normally I would just add another entity…
Prionum
  • 133
  • 1
  • 2
  • 7
0
votes
2 answers

Simple binary reader-writer code not working

MS VS 2010, XNA 4.0 So, I have a class Planet & it has Save and Load functions. public void SaveToFile(ContentManager content) { string path = content.RootDirectory + @"\Objects\Planets\" + this.name +@".planet"; using…
Monset
  • 648
  • 5
  • 25
0
votes
1 answer

Matlab fwrite in C#

I have a piece of code that i am trying to implement in C#. The code writes a file using the frwite command using Matlab. I have tried looking at the documentation and doing some examples to understand how does frwite works. I tried the following…
ykh
  • 1,775
  • 3
  • 31
  • 57
0
votes
2 answers

Cannot access closed file during Reading/Writing operation - C#

I have searched the internet and viewed many posts, but none has helped me. So I decided to ask my own question over here. I am writing some data to binary file when the save button on my form is clicked, and reading that data from the file when the…
0
votes
1 answer

Writing string and bytes to the same FileStream

I need to create a file where some parts are strings (utf-8), while some parts are bytes. I tinkered for hours with StreamWriter and BinaryWriter, but this is the only thing that works: using (var stream = new FileStream(_caminho,…
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
0
votes
0 answers

Tcpclient binaryreader not receiving a specific packet C#

So let me make this clear, I'm quite new to packets and networking. So I'm working on a project where there'll be 1 server and 4 clients all connected to the server. I've gotten most of my packets working, both sides but I've gotten problems with…
0
votes
2 answers

Create Binary file of text that notepad can't read

I am attempting to create a binary file that is not readable by notepad in windows. This file needs to contain text information. The current code I run is readable in notepad (with a few extra characters here and there, but still human readable).…
0
votes
1 answer

BinaryWriter to MemoryStream in Java

I have C# program that makes a tcp connection with another c# program. In the c# program to send an message I did this : private TcpClient client; private void SendPulse() { byte[] send_Buffer; port = 11000; while (true) { …
RonYamin
  • 77
  • 2
  • 11
0
votes
0 answers

How to read from to different memorystreams?

I have this method in my client it sends to the model an integer whenever i click a button in my clientform. public void SetInput(int index) { String go = index.ToString(); //String string = "YES"; MemoryStream memory…
user3645080
  • 21
  • 1
  • 5
0
votes
1 answer

C# BinaryWriter buffer for sending segments?

I'm not sure that a "Buffer" is what I'm looking for, so I'll show you my problem and then you guys can decide if that's the correct word and on a solution. Currently I'm working on creating a networking port for the Java DataOutputStream class in…
Hobbyist
  • 15,888
  • 9
  • 46
  • 98