Board index » delphi » Need help reading file contents to string variable

Need help reading file contents to string variable

Hello,
I have a file which contains extended ASCII data (i.e. 0-255, not 127), and
I am trying to read this into a string variable.  I've found a way to do it,
but it results in a EInvalidPointer operation, but only every now and then.
Any ideas?  Any simple techniques for reading a file into a string which I
may have overlooked?  And before I get flamed, yes, I've tried the simple
Read, ReadLn, and StringList.ReadFromFile procedures - they're only
compatible with standard ASCII, not extended.  :-)

Thanks,
Kamal

 

Re:Need help reading file contents to string variable


In article <6qna12$ak...@supernews.com>, "Kamal Gautam"

Quote
<gaut...@bremer-inc.com> writes:
>I have a file which contains extended ASCII data (i.e. 0-255, not 127), and
>I am trying to read this into a string variable.

Post the code you've tried so far and we'll amend it. Incidentally - if the
file contains
#0 as say it's third character, even though the file may be large, your string
would contain two characters

Charles Johnson

Re:Need help reading file contents to string variable


In article <6qna12$ak...@supernews.com>, "Kamal Gautam"

Quote
<gaut...@bremer-inc.com> writes:
>I have a file which contains extended ASCII data (i.e. 0-255, not 127), and
>I am trying to read this into a string variable.  I've found a way to do it,
>but it results in a EInvalidPointer operation, but only every now and then.
>Any ideas?  Any simple techniques for reading a file into a string which I
>may have overlooked?  And before I get flamed, yes, I've tried the simple
>Read, ReadLn, and StringList.ReadFromFile procedures - they're only
>compatible with standard ASCII, not extended.  :-)

Use streams (TFileStream, TMemoryStream).

Alan Lloyd
alangll...@aol.com

Other Threads