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

2019-10-13 Thread Christo Crause
On Sun, Oct 13, 2019 at 8:03 PM Ched <
charles.edouard.des.vastes.vig...@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'
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


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

2019-10-13 Thread Ched

Hello,

In https://www.freepascal.org/docs-html/rtl/sysutils/filenameroutines.html ,

FileSetDate Get file dates  should be 
corrected to _S_et .



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.

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

Cheers, Ched'
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal