[fpc-pascal] *etFTime -> File*etDate

Christo Crause christo.crause at gmail.com
Sun Oct 13 20:57:17 CEST 2019


On Sun, Oct 13, 2019 at 8:03 PM Ched <
charles.edouard.des.vastes.vignes at gmail.com> wrote:

> Hello,
>
> In https://www.freepascal.org/docs-html/rtl/sysutils/filenameroutines.html
> ,
>
> FileSetDate <
> https://www.freepascal.org/docs-html/rtl/sysutils/filesetdate.html>Get
> file dates  should be
> corrected to _S_et .
>
I don't see any mix-up of Get and Set on either the FileSetDate or
FileGetDate pages at your link above.


> Now, my real problem is that the following code is compiled when SYS is
> not defined, and isn't when it
> is, and I really don't know why.
>
> PROGRAM QQ;
>     { $DEFINE SYS}
> USES
>     {$IFDEF SYS}
>        SYSUTILS;
>     {$ELSE}
>        DOS;
>     {$ENDIF}
> VAR
>     FO: FILE OF DOUBLE;
>     L: LONGINT;
> BEGIN
>     ASSIGN(FO, 'blabla.bin');
>     RESET(FO);
>     {$IFDEF SYS}
>        L:=FILEGETDATE(FO);   { Got File, expected LongInt }
>     {$ELSE}
>        GETFTIME(FO, L);
>     {$ENDIF}
>     CLOSE(FO);
> END.
>

The file variable FO in your code should be declared as type THandle (which
is an alias for LongInt) when you are using the SysUtils file handling
routines.  Take a look at the example at the bottom of FileCreate (
https://www.freepascal.org/docs-html/rtl/sysutils/filecreate.html) to see
how to work with these routines.


> Well, it appears that I prbably haven't fully understand the dos->sysutils
> conversion.
>

You are mixing classic Pascal style file handling (Assign, Reset, Close)
which isn't (AFAIK) Dos style, with an alternative file handling style
defined in SysUtils.

Cheers, Ched'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20191013/3f1cd7c6/attachment.html>


More information about the fpc-pascal mailing list