- Home /
Question by
commodore · Dec 24, 2014 at 07:37 PM ·
binarywriter
BinaryReader not returning anything
I'm trying to write "test" to the memory stream and print it but nothing shows up. Here what my code looks like:
var memStream : MemoryStream = new MemoryStream();
var writer : BinaryWriter = new BinaryWriter(memStream);
writer.Write("test");
// Create the reader using the same MemoryStream
// as used with the writer.
var binReader : BinaryReader = new BinaryReader(memStream);
// Set Position to the beginning of the stream.
memStream.Position = 0;
// Read the data from memory and write it to the console.
print(binReader.ReadString());
writer.Close();
memStream.Close();
binReader.Close();
Comment
Your answer
Follow this Question
Related Questions
Using BinaryWriter/Reader to save levels? 1 Answer
Problem with my binary files 1 Answer
How read memory stream in other app? 1 Answer
How to save a ui button for binary formatter 2 Answers
upload file using binarywriter to server 3 Answers