[proFit-list] Writing to text file

pro Fit Support profit at quansoft.com
Thu Aug 21 22:26:54 CDT 2008


Andrew

Use CreateTextFile instead of OpenTextFile. OpenTextFile is for reading.

The last parameter of CreateTextFile defines what happens if the file  
already exists. This parameter can take the following values:
0 = new file required,
1 = append if existing text file,
2 = overwrite if existing text file,
3 = overwrite any existing file

Example:

program User_Program;
var myFileRef;

begin
	myFileRef := CreateTextFile('myfile.txt', 1);
	WriteToTextFile(myFileRef);
	writeln('Hello World');
	CloseTextFile(myFileRef);
end;



Best regards

Kurt Sutter
QuantumSoft




On 21. Aug 2008, at 21:05, Andrew Cameron Beveridge wrote:
> I am using OS X 10.4.11 and proFit 6.1.8.
>
> I am having difficulties with the "WriteToTextFile" procedure.
>
> Basically I do this;
>
> myFileRef := OpenTextFile(file 'myFile');
>
> WriteToTextFile(myFileRef);
> begin
> writeln('Hello World');
> end;
>
> CloseTextFile(myFileRef);
>
> I always get System Error -61
>
> Does WriteToTextFile append the line to the end of the file?
>
> Thanks for your help.
>
> Regards,
> Andrew



More information about the proFit-list mailing list