Ooops
November 28, 2020, 01:51:55 PM

Author Topic: [bb] osx file attributes by Dabhand [ 1+ years ago ]  (Read 538 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] osx file attributes by Dabhand [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : osx file attributes
Author : Dabhand
Posted : 1+ years ago

Description : Find various file attributes on osx:-

- Last accessed: Use ctime(&fst.st_atime)
- Last modified: Use ctime(&fst.st_mtime)
- Last changed: Use ctime(&fst.st_ctime)

C++ code in the example returns 'Last accessed' information.

Sorry, this is for Blitzmax... I buggered the language tagging up! Sorwy


Code :
Code: BlitzBasic
  1. //findmeta.m
  2. #include <sys/stat.h>
  3.  
  4. char * FindMeta(char *filepath)
  5. {
  6.         struct stat fst;
  7.         bzero(&fst,sizeof(fst));
  8.  
  9.         if (stat(filepath,&fst) != 0) { return("");}
  10.        
  11.         return(ctime(&fst.st_atime));
  12. }
  13.  
  14.  
  15. 'Blitzmax example
  16.  
  17. Import "findMeta.m"
  18.  
  19. Extern "C"
  20. Function FindMeta$z(filepath:Byte Ptr)
  21. End Extern
  22.  
  23. Print FindMeta(CurrentDir$()+"/test.app")


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal