2

Ok so I have a Binary text file written using a BinaryWriter. The format of the file has been lost due to poor documentation.

Im using the BinaryReader to read the file but the only way I can do this is through trial and error by stepping through the file and guessing whether I should be using the ReadInt64(), ReadString() etc of the BinaryReader class.

Is there anyway to step through the file and automatically determine what the next value format is?

2
  • There is no such thing as a "binary text file". A file is either binary, meaning that the bytes represent data in some arbitrary (but known) form, or it is a text file, meaning that the bytes encode text characters in one of the known text encodings. Commented Jul 31, 2013 at 15:50
  • You might consider opening the file in a binary (hex) file viewer so that you can examine the format. That's going to give you a much better idea of how to read it than using trial and error with BinaryReader. Visual Studio will display a binary file. Commented Jul 31, 2013 at 16:52

1 Answer 1

2

No. The BinaryWriter does not pack any type information into the written file, so there is no way to reverse-engineering that - other than trial & error, as you have found out.

Sign up to request clarification or add additional context in comments.

1 Comment

Bah that's not what I wanted to hear.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.