Saving Memo lines to a file
Quote
In article <Xns90C2368C4FA7r3...@207.105.83.65>, Ron wrote:
> I have a Memo getting new lines, and I want to add the option of writing
> these lines into a file when they appear (one at a time).
> The route I follow is :
> 1. AssignFile(myfile, 'logfile.txt')
> 2. Rewrite(myfile) or Append(myfile)
> 3. Writeln(myfile, Memo.Line[Memo.Line[Memo.Line.Count-1])
> 4. CloseFile
> where myfile is declared as a textfile.
> Now the strange thing is that this gives me a BSOD if I try to write memo
> lines or if I try to put the commands in different procedures. It works ok
> if I put everything in a row and do Writeln(myfile 'test')
> I would like to put steps 1, 2 in an initializing procedure, step 3 in a
> procedure which deals with Memo output, and 4 in a procedure which is
> called when everything is finished. Is there something I am missing?
There is no principal problem with your scheme, so it has to be some detail
in your code you do wrong. One thing: the method doing the output to the memo
will probably get the text as a String parameter. So use this parameter for
Writeln, do not get the text from the memo after you added the line there.
Peter Below (TeamB) 100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!
Note: I'm unable to visit the newsgroups every day at the moment,
so be patient if you don't get a reply immediately.