rainbow-girl
Member
- Joined
- Jul 27, 2024
- Messages
- 12
- Programming Experience
- Beginner
Hi
I try to read the LAST 6 bytes from a file. The output is 6 bytes which are 0.
But when I open the file with a hex editor, the last 6 bytes are not 0. What is wrong with my code?
This is the file:
code:
output:
0, 0, 0, 0, 0, 0,
I try to read the LAST 6 bytes from a file. The output is 6 bytes which are 0.
But when I open the file with a hex editor, the last 6 bytes are not 0. What is wrong with my code?
This is the file:
code:
C#:
public void PrintByteArray(byte[] bytes)
{
var sb = new StringBuilder("");
foreach (var b in bytes)
{
sb.Append(b + ", ");
}
Console.WriteLine(sb.ToString());
}
FileStream filestream = File.Open("TL09.THF", FileMode.Open);
//laatste 6 bytes
filestream.Seek(6, SeekOrigin.End);
byte[] last6bytes = new byte[6];
filestream.Read(last6bytes, 0, 6);
PrintByteArray(last6bytes);
0, 0, 0, 0, 0, 0,
Last edited by a moderator: