How to read all contents from a file containing RTF text?

Tuskony
04-20-2003, 01:20 PM
I tried doing a few searches for my answer, but i'm not exactly sure what i'm looking for.

Here is what I'm doing: I'm logging MSN Messenger conversations in my MSN addon program.

I'm saving the RTF text in the message window into a .txt file so what all colour codes, and fonts are also saved, so when the log file is viewed in my program all the colour codes and fonts show up like they did in the convo window.

I'm using the following code to save the contents of the converstation RichText Box....


Open App.Path & "\Logs\Test.txt" For Append As #1
Print #1, MsgWnd.TextRTF
Close #1


This works fine, and the text file gets saved with all the info it needs to.
The problem lies when i try and read the contents of the logged conversation. Only the text that gets saved FIRST in the text file is read, when I use the following code...


Dim Str As String
Dim FF As Integer

FF = FreeFile
MsgWnd.Text = ""
Open App.Path & "\Logs\Test.txt" For Input As #FF
Str = Input$(LOF(FF), #FF)
Close #1
MsgWnd.TextRTF = Str


Text that is written to the file after the first set of text doesn't get read.

For example if I saved the following lines in order:

First piece of text
second
third
and so on....

If i saved those strings one after another, the only one that would get read back into the the RTB when a log is view would be "First piece of text" and I can't figure out why.

Any help would be greatly appreciated, thanks....

Oh, i've attached a sample log file called "Test.txt" if anyone wants to see how the files are saved.

Thanks.

Tuskony
04-20-2003, 02:24 PM
I forgot about the .LoadFile and .SaveFile properties. But this still doesn't solve my problem. It seems the file only gets read upto the end of the first save which is "\par }".

I tried splitting the incoming data using Split(File, "\par }") and that worked, sort of. However that showed all the RTF text, but it seems like it showed every line twice, and every second line wasn't converted into regular text :(

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum