I usually just make a wrapper function, and keep it in a utility unit with some other similarly useful stuff. Here's my code:
type reset_or_rewrite_enum_type = (resetit, rewriteit); function open_file (var f : file; file_name : ansistring; whattodo : reset_or_rewrite_enum_type) : boolean; var io_result : integer; begin assign (f, file_name); if whattodo = resetit then {$I-} reset (f) {$I+} else {$I-} rewrite (f); {$I+} io_result := ioresult; if io_result = 0 then open_file := true else begin open_file := false; write ('Error: '); if whattodo = resetit then write ('Reset ') else write ('Rewrite '); writeln (file_name, ' returned ', io_result, ': ', error_description(io_result)); end; end; function reset_file (var f : file; file_name : ansistring) : boolean; begin reset_file := open_file (f, file_name, resetit); end; function rewrite_file (var f : file; file_name : ansistring) : boolean; begin rewrite_file := open_file (f, file_name, rewriteit); end; ~David. -------- Original Message -------- > From: "Lance Boyle" <[EMAIL PROTECTED]> > Sent: Tuesday, September 13, 2005 2:39 AM > To: "FPC-Pascal users discussions" <fpc-pascal@lists.freepascal.org> > Subject: [fpc-pascal] About reset(aFile, FileNameString) > > "Official" Pascal for opening a file and associating a name with it > (e.g., a disk file) goes like this: > > assign(aFile, FileNameString); > reset(aFile); {or rewrite, etc.} > > All of the Pascals that I have used allowed the following shorthand, > an extension: > > reset(aFile, FileNameString); {or rewrite, etc.} > > At least one of these Pascals was not a Macintosh Pascal, so I never > considered it a "Mac" extension. Yet, I can find no possibility of > this in FPC, in spite of its various compatibility modes. > > I tried overloading reset() (newbie alert on the overloading thing) > but it didn't work. > > What say ye? > > Lance > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal