Page 1 of 1

_stat()

Posted: Tue Dec 29, 2015 2:20 pm
by Poshu

Code: Select all

Structure stat
  st_dev.l;                   /* ID of device containing file */
  st_ino.l;                   /* File serial number */
  st_mode.w;                  /* Mode of file */
  st_nlink.w;                 /* Number of hard links */
  st_uid.w;                   /* User ID of the file */
  st_gid.w;                   /* Group ID of the file */
  st_rdev.l;                  /* Device ID */
  st_size.l;                  /* file size, in bytes */
  st_atimespec.i;      /* time of last access */
  st_mtimespec.i;      /* time of last data modification */
  st_ctimespec.i;      /* time of last status change */
EndStructure

ImportC "msvcrt.lib"
  _stat(path.p-ascii, *buf)
EndImport

Name.s = OpenFileRequester("Choose a file", "", "", 0)
_stat(Name, @stats.stat)

Debug FileSize(Name)
Debug "File size : " + stats\st_size
Debug "Last access : " + FormatDate("%yyyy/%mm/%dd", stats\st_atimespec)
CallDebugger
Thanks to Djes on the french forum/

Re: _stat()

Posted: Wed Dec 30, 2015 8:38 am
by GoodNPlenty
Very nice, Thank You for sharing.