I think I do something wrong. I typed the whole first example in Lazarus, but I get an error: Expected Unit, found Program. The very first word is done wrong (probably by myself) :|
By the way; I chose option A.
This is what I got right now:
program CreatFile;
uses
Sysutils;
const
C_FNAME = 'textfile.text';
var
tf0ut: Textfile;
begin
AssignFile(tf0ut, C_FNAME);
{$I+}
try
rewrite(tf0ut);
writeln(tf0ut, 'Hello textfile!');
writeln(tf0ut, 'The answer to life, the universe and everything: ', 42)
CloseFile(tf0ut);
except
on E: EInOutError do
writeln('file handling error occured. Details: ', E.ClassName, '/' E.Message);
end;
writeln('file ' C_FNAME, 'created if all went ok. Press enter to stop.');
end.
An example of what Im not sure about is:
The piece of code C_FNAME. Should I replace NAME by a name given by me? Or goes it say that the name = ... (TextFile in the given example)?