<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
This is probably a no-brainer to most of the DUG members, especially those used to pointers ...<br><br>I need to read and extract data from a binary file which comprises:<br>- a header with character type strings, each terminated by CR LF (not nulls)<br>- binary data area with a mixture of byte types, word types and double word types<br>- a file terminator of 0xFFFF hex<br><br>The files are not huge, less than 500KB, as the structure originates from old memory-constrained microprocessors of the 80's.<br><br>The header looks like it is based on the old INI file format and is of the form:<br><br>[Header]<br>Created=1349233072<br>Title=<br>Type=D<br>Version=162<br>[End]<br><br>The binary data area follows next. It comprises different types of data blocks, with sub blocks, each of which contains either bytes, words or double words of data in a pre-defined pattern or structure depending on the type of data block.<br><br>I can read the file into a buffer (array of Char) but I currently have a
chunk of somewhat ugly code to parse the header and find the start
position of the binary data after the '[End] CR LF' string. After that I need to extract data of various types depending on the specified datablock types, which I though I might have to use pointers for.<br><br>What's the best approach for <br>a) Extracting the header strings - is there a Delphi function to extract CR LF terminated character sequences as strings and maintain a pointer to the end of the string?<br>b) Creating functions for ReadByte, ReadWord, ReadDoubleWord and incrementing the pointer appropriately in each case ?<br><br><br>Eric<br><br>                                            </div></body>
</html>