Topic: string to textfile

Hi
I´m trying to learn something about 'scripting' and looking on Delphi user guides to get some knowledge.
I want to save information contained in a field to a text file

Can´t use something like this:

frmocam.Edit1.text.Savetofile('ficheiro.txt');

because i get the message

"strings do not have properties or methods."

I also saw on a delphi manual something like:

AssignFile(myFile, 'Test.txt'); but that does notseam to work here.

Can you help me?

Thanks

Re: string to textfile

Hello


An example:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
var
    sl: TStringList;
begin
    sl := TStringList.Create;
    sl.Text := frmocam.Edit1.text;
    sl.SaveToFile('ficheiro.txt');
    sl.Free;
end;
Dmitry.

Re: string to textfile

Great!

Now i understand that the reverse process is done with the LoadFromFile statement.

Thanks so much Dmitry.

One more question: I call and external program with OpenFile('x.exe'), and it works ok.
Is there any possibility for passing parameters?

Thanks again.

Re: string to textfile

luisfilipeipam wrote:

One more question: I call and external program with OpenFile('x.exe'), and it works ok.
Is there any possibility for passing parameters?

Thanks again.

Yes, example:

OpenFile('params','x.exe');
Dmitry.