Back to manual index
:: assign()
:: Type = Filesystem function
:: Environment = Windows, Linux, Unix
:: What = Assigns a file to file pointer
:: Note = Unlike other Pascals, assign is not required with GibPascal as the
assign can happen within the append or rewrite functions.
Example:
Program AssignExample;
{ Program to demonstrate the Assign, Rewrite, and Append functions. }
Var TestTextFile : text;
begin
assign(TestTextFile,'test.txt');
rewrite(TestTextFile); { file is opened for write }
writeln(TestTextFile,'This is the first line of text.txt');
close(TestTextFile);
append(TestTextFile); { file is opened for append write }
writeln(TestTextFile,'This is the second line of text.txt');
close(TestTextFile);
end. |