file-problem

Started by
4 comments, last by TheSisko 22 years, 6 months ago
I''m quite new to working with files, and I have a problem. This is the body of my function (what is of importance to you): AssignFile(Text,SaveDialog1.FileName); Rewrite(Text); Write(Text, memo1.lines); CloseFile(text); I declared ''text'' as : var Text:Textfile; Any help?
Advertisement
Try using Memo1.Text instead of Memo1.Lines. Lines returns a TStrings-based object, not a string.

Steve ''Sly'' Williams  Monkey Wrangler  Krome Studios
Steve 'Sly' Williams  Monkey Wrangler  Krome Studios
turbo game development with Borland compilers
Heheh, oh right
How stupid of me. ty
Well, I have it solved now, but I don't really remember what I actually did.....
That's the way it usually goes with me: type something, compile, not working. Add some begins and ends, some: , and try again heheh

the code now looks like this:
procedure TForm1.SaveText;var  Text:textfile;begin  if SaveDialog1.Execute then  begin    AssignFile(Text,SaveDialog1.FileName);    Rewrite(Text);    Write(Text, memo1.text);    CloseFile(text);  end;end; 


Edited by - TheSisko on October 19, 2001 1:57:43 AM
Hi there,

you could also just call

Memo1.Lines.SaveToFile(FileName);

but i suspect you knew that

Mark.

Well......not quite..... heheh
Told you I''m a newbie at working with files.......

This topic is closed to new replies.

Advertisement