From Clomosy Docs
function ClSaveToFile(const FilePath, FileContent:String): String;
FilePath : The file path where the file will be saved is specified. This typically includes a directory and a file name, such as 'C:\Users\User\Documents\cl.txt'.
FileContent : It generates the text content to be saved to the file. This can be a string value or a string data coming from an object such as TclMemo or TclEdit.
In Clomosy, the clSaveToFile procedure performs the operation of saving a file to the specified file path. This procedure saves either a string content or the data of an object to the designated file. The data is stored in the file so it can be read or used for other purposes later.
If the specified file does not exist, it saves the file to the desired directory. If the file exists, it clears the file's content and performs the save operation by overwriting it.
If the file path is not specified, the file is saved to the directory where the Clomosy Learn application is located.
The general usage is as follows:
clSaveToFile(Clomosy.AppFilesPath+'cl.txt','Test 1');
clSaveToFile('cl.txt','Test 1');
Example
It saves the data written in a TclMemo object to the specified file directory.
var
Form1:TclForm;
Memo1 : TclMemo;
Layout1 : TclLayout;
BtnAdd : TclProButton;
void BtnAddOnClick;
{
//ShowMessage(Clomosy.AppFilesPath);
clSaveToFile(Clomosy.AppFilesPath+'cl.txt',Memo1.Text);
}
{
Form1 = TclForm.Create(Self);
Memo1 = Form1.AddNewMemo(Form1,'Memo1','');
Memo1.Align = alMostTop;
Memo1.Height = 200;
Memo1.Width = 150;
Memo1.Margins.Left= 10;
Memo1.Margins.Right= 10;
Memo1.Margins.Top= 10;
Memo1.TextSettings.WordWrap = True;
Layout1 = Form1.AddNewLayout(Form1,'Layout1');
Layout1.Align=ALTop;
Layout1.Height = 50;
BtnAdd = Form1.AddNewProButton(Layout1,'BtnAdd','');
BtnAdd.Align = AlRight;
BtnAdd.Margins.Right = 10;
BtnAdd.Width = 70;
Form1.AddNewEvent(BtnAdd,tbeOnClick,'BtnAddOnClick');
Form1.SetImage(BtnAdd,'https://clomosy.com/demos/add-list.png');
Form1.Run;
}