I want to write a small program to read a file, from offset 0xFB650 to offset 0xFB656 and show value in a text box.
Who can help me?
I want to write a small program to read a file, from offset 0xFB650 to offset 0xFB656 and show value in a text box.
Who can help me?
google can help you
I searched but don't work, can you give me an example?
How to read file binary in C#? - Stack Overflow
all is here for binary reading for offset just ignore the offset first byte of the file.
BinaryReader bin = new BinaryReader();
byte[] bytes = new bytes[0xFB656 - 0xFB650];
bin.Read(bytes, 0xFB650, bytes.Length);
i just made it from my head, i dont give guarantee that this works.
Last edited by bergi9; 14-09-13 at 05:39 PM. Reason: no need for a loop
my god let him have the research....
He wont learn it just by copy and paste code lines, you write to him.
Also, I think what he needs, is the Seek method of the FileStream Class in combination with some methods of the BinaryReader Class...
Code:private void Form1_Load(object sender, EventArgs e) { string path = @"C:\test.bin"; using (FileStream fs = File.OpenRead(path)) { byte[] b = new byte[6]; UTF8Encoding temp = new UTF8Encoding(true); fs.Position = 0xFB650; fs.Read(b, 0, b.Length); textBox1.Text = temp.GetString(b); fs.Close(); } }![]()
good work, thanks for your help!