binaryreader Questions
8
Solved
I'm trying to improve my understanding of the STFS file format by using a program to read all the different bits of information. Using a website with a reference of which offsets contain what infor...
Byars asked 23/12, 2011 at 21:43
5
Solved
I came across a situation where I have a pretty big file that I need to read binary data from.
Consequently, I realized that the default BinaryReader implementation in .NET is pretty slow. Upon lo...
Halfway asked 6/8, 2009 at 11:47
6
Solved
Is there an elegant to emulate the StreamReader.ReadToEnd method with BinaryReader? Perhaps to put all the bytes into a byte array?
I do this:
read1.ReadBytes((int)read1.BaseStream.Length);
......
Kowalski asked 23/12, 2011 at 7:5
2
Solved
When reading C# NetworkStream (from stream-type TCP socket), BinaryReader.ReadChar occasionally throws exceptions System.ArgumentException: The output char buffer is too small to contain the decode...
Helot asked 30/8, 2013 at 10:21
5
Solved
I was searching for a way to check whether I've reached the end of a file for my binary reader and one suggestion was to use PeekChar as such
while (inFile.PeekChar() > 0)
{
...
}
However, i...
Petulance asked 8/6, 2012 at 3:48
3
Solved
I use the following code to read BigEndian information using BinaryReader but I'm not sure if it is the efficient way of doing it. Is there any better solution?
Here is my code:
// some code to i...
Hudnall asked 18/1, 2013 at 14:43
3
Solved
I am working on improving a stream reader class that uses a BinaryReader. It consists of a while loop that uses .PeekChar() to check if more data exists to continue processing.
The very first oper...
Bacardi asked 24/8, 2011 at 20:48
4
Solved
I'm trying to download a number of pdf files automagically given a list of urls.
Here's the code I have:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
...
Displacement asked 10/8, 2012 at 12:9
3
I have a list of float to write to a file. The code below does the thing but it is synchronous.
List<float> samples = GetSamples();
using (FileStream stream = File.OpenWrite("somefile.bin")...
Craal asked 15/2, 2016 at 16:49
5
Solved
BinaryReader does not have EndOfStream property. Is it safe to use following code to check if end of stream is reached?
reader.BaseStream.Length>reader.BaseStream.Position
Impercipient asked 20/9, 2010 at 15:31
2
Solved
I am using a networking protocol built around TcpClient, using BinaryReader to read bytes from the underlying NetworkStream (and, conversely, using BinaryWriter to write).
The protocol transmits s...
Kiblah asked 14/12, 2015 at 18:19
2
Solved
The .NET BinaryReader/BinaryWriter classes can be constructed with specifying an Encoding to use for String-related operations.
I was implementing custom string formats with extension methods, but...
Joses asked 3/4, 2015 at 16:15
4
Solved
I've run into what I believe is an issue with the BinaryReader.ReadChars() method. When I wrap a BinaryReader around a raw socket NetworkStream occasionally I get a stream corruption where the stre...
Keim asked 26/11, 2009 at 15:48
2
Solved
I have source below:
public static void DisplayValues()
{
float aspectRatio;
string tempDirectory;
int autoSaveTime;
bool showStatusBar;
if (File.Exists(fileName))
{
using (BinaryReader re...
Weslee asked 23/2, 2014 at 13:48
3
Solved
Because of the under the hood buffering strategy of BinaryReader, it is unclear to me whether is it ok or not to read an offset stored in a stream, then reposition the stream at this offset to resu...
Meliamelic asked 2/10, 2013 at 9:49
4
Solved
I created a byte array with two strings. How do I convert a byte array to string?
var binWriter = new BinaryWriter(new MemoryStream());
binWriter.Write("value1");
binWriter.Write("value2");
...
Dissonance asked 25/7, 2012 at 16:39
2
Solved
I am using a BinaryReader on top of a NetworkStream to read data off of a network. This has worked really well for me, but I want to understand what's going on behind the scenes, so I took a look a...
Neves asked 30/5, 2012 at 5:31
1
Solved
Both StreamReader and BinaryReader can be used to get data from binary file ( for example )
BinaryReader :
using (FileStream fs = File.Open(@"c:\1.bin",FileMode.Open))
{
byte[] data = new Bin...
Empiricism asked 27/4, 2012 at 15:56
1
Solved
I am trying to decompress a byte array and get it into a string using a binary reader. When the following code executes, the inStream position changes from 0 to the length of the array, but str is ...
Stink asked 10/8, 2011 at 15:49
1
Solved
Assume the following code:
Stream file = files[0].InputStream;
var FileLen = files[0].ContentLength;
var b = new BinaryReader(file);
var bytes = b.ReadBytes(FileLen);
If I upload a CSV file th...
Swanky asked 3/2, 2011 at 7:57
1
Solved
I am trying to figure out what I am doing wrong here. I am attempting to use a Binary Reader to ease getting an initial four bytes from a stream into an Int32 value that tells me how long the rest ...
Ansley asked 24/11, 2010 at 0:3
1
© 2022 - 2024 — McMap. All rights reserved.