TIP: Click on subject to list as thread! ANSI
echo: delphi
to: SCOTT CLARK
from: GARY WEINFURTHER
date: 1997-10-23 09:02:00
subject: TStringList and Null Characters

Scott Clark mentioned this to All:
 SC> How can I get around this?  I get the feeling I should be in a
 SC> loop just reading the file a line at a time and somehow using
 SC> the StrPas function to convert it to a Pascal string before adding
 SC> it to the StringList.  But How?
What version of Delphi are you using?  A loop, as you described, may be the 
best way to go, but you shouldn't need to use StrPas.  Use AssignFile, Reset, 
Readln, and CloseFile to handle the file I/O.
Or, depending on the file size, read the entire file into a stream (for 
example, an instance of TMemoryStream), manipulate the data to replace the 
nulls, then use TStringList.LoadFromStream.
Or read the entire file into one big string (Delphi 2 & 3 only), manipulate 
it, then put it into the string list with the TStringList.Text property.
                                ...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI. (1:2410/905)

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™.