TIP: Click on subject to list as thread! ANSI
echo: delphi
to: ALL
from: SCOTT CLARK
date: 1997-10-21 20:49:00
subject: TStringList and Null Characters

Hi All,
I have a programming problem which some of you should be able to help me 
th.
I have the following chunk of Delphi code:-
{--- Start of Code ---}
 var
   EJList: TStringList;
 begin
   EJList := TStringList.Create;
   EJList.Clear;
   EJList.LoadFromFile('FILENAME.EXT');
 end;
{--- End Of Code ---}
This obviously takes a file and puts its contents in a TStringList.  
My problem is that the file could have null characters (Hex:00) in
the middle of the file, and this then gets treated as a null
terminated string and so the TStringList stops filling up.  
How can I get around this?  I get the feeling I should be in a
loop just reading the file a line at a time and somehow using
the StrPas function to convert it to a Pascal string before adding
it to the StringList.  But How?
I am new to Delphi from a COBOL background where such things are 
alien - that's my excuse for not knowing anyway.
Thanks in advance,
  __
 (__  _  _ ___ ___
 ___)(_ (_) |   |
Scott Clark
FidoNet: 2:250/266.2
E-Mail:  scott@falihax.demon.co.uk
Web:     www.falihax.demon.co.uk
--- Bonzo 1.3.0.12 #0006
---------------
* Origin: Halifax (2:250/366.2)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.