Hi,
> If anyone knows a way to preserve indents
> in posted code please let me know.
They are preserved if you receive messages by email
and display them in plain text:
[email protected]
Using > is a bad idea because it makes it look as though
you are quoting someone else's code. And whatever you
use, it will only preserve a single space indent in HTML.
It's better to replace all multiple spaces with a visible
character such as ~.
function StringInFile(strFind, strFileName: string): boolean;
const
~ BUFSIZE = 8192;
var
~ fstm: TFileStream;
~ numread: Longint;
~ buffer: array [0..BUFSIZE-1] of char;
~ szFind: array [0..255] of char;
~ found: boolean;
begin
~ StrPCopy(szFind, strFind);
~ found := False;
~ fstm := TFileStream.Create(strFileName, fmOpenRead);
~ repeat
~~~ numread := fstrm.Read(Buffer, BUFSIZE);
~~~ if BMFind(szFind, Buffer, numread) >= 0 then
~~~~~ found := True
~~~ else if numread = BUFSIZE then // more to scan
~~~~~ fstm.Position := fstmPosition - (Length(strFind)-1);
~ until found or (numread < BUFSIZE);
...
regards,
Martin.