How to Read a File in Hex Code.....(Hex Edit Style....)
Posted: Tue Dec 09, 2003 1:03 am
Code updated for 5.20+
Same for Unsigned Binary..
Code: Select all
#File = 0
Procedure.s _ReadHEX(Filename.s)
If OpenFile(#File,Filename.s)
Repeat
CurPos.l = FileSeek(#File,Loc(#File))
RetVal.s = RetVal.s+Hex(ReadByte(#File))+" "
Until Eof(#File)
CloseFile(#File)
EndIf
ProcedureReturn RetVal.s
EndProcedure
Debug _ReadHEX("c:\test2.bck")Code: Select all
#File = 0
Procedure.s _ReadBIN(Filename.s)
If OpenFile(#File,Filename.s)
Repeat
CurPos.l = FileSeek(#File,Loc(#File))
RetVal.s = RetVal.s+Str(ReadByte(#File))+" "
Until Eof(#File)
CloseFile(#File)
EndIf
ProcedureReturn RetVal.s
EndProcedure
Debug _ReadBIN("c:\test2.bck")