Board index » delphi » Read TMemoField into PChar

Read TMemoField into PChar

Using Delhpi 1.

I'm using TStringList.Assign( tMemoField ), then appending the
tStringList[Strings[...] to my PChar.

I need to write the whole lot to a file.

Here is the problem:

This seems to work fine until 3rd record, then I get the message: "Project
Discard.EXE raised exception class EStreamError with message 'Line too long'.
Process stopped..."

When I view the contents of the memo field in the database via a DBMemo, the
record causing the error is no longer than the previous 2 records.

Any help on this would be greatly appreciated.

Please cc me at dani...@symmetry.co.za

Thanks

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading

 

Re:Read TMemoField into PChar


In article <6d5uvr$k9...@nnrp1.dejanews.com>, celt...@iafrica.com writes

Quote
>Using Delhpi 1.

>I'm using TStringList.Assign( tMemoField ), then appending the
>tStringList[Strings[...] to my PChar.

>I need to write the whole lot to a file.

>Here is the problem:

>This seems to work fine until 3rd record, then I get the message: "Project
>Discard.EXE raised exception class EStreamError with message 'Line too long'.
>Process stopped..."

>When I view the contents of the memo field in the database via a DBMemo, the
>record causing the error is no longer than the previous 2 records.

Why are you adding all of your memo records to a TStringList and then
creating one long PChar from all of the TStrings just to write the
text to a file?

Wouldn't it be easier to simply loop through the table and WriteLn the
contents of each memo to a file?

(Incidentally, your problem *is* that the string gets too long -
Delphi 1 strings can be a maximum of 255 characters. Use dynamic
allocation if you need more memory than this).
--
Jeremy Collins

Other Threads