[Gambas-user] Inode from file and Gambas
    vuott at tutanota.com 
    vuott at tutanota.com
       
    Thu Mar  2 06:12:48 CET 2023
    
    
  
...or you could use the "Extern" resource:
Library "libc:6"
Public Struct stat_
  st_dev As Long
  st_ino As Long
  st_nlink As Long
  st_mode As Integer
  st_uid As Integer
  st_gid As Integer
  __pad0 As Integer
  st_rdev As Long
  st_size As Long
  st_blksize As Long
  st_blocks As Long
  st_atime As Long
  st_atimensec As Long
  st_mtime As Long
  st_mtimensec As Long
  st_ctime As Long
  st_ctimensec As Long
  __glibc_reserved[3] As Long
End Struct
Private Const _STAT_VER_LINUX As Integer = 1
' int __xstat (_STAT_VER, __path, __statbuf)
' Get file attributes for FILE and put them in BUF.
Private Extern __xstat(_STAT_VER As Integer, __path As String, __statbuf As Stat_) As Integer
Public Sub Main()
  Dim i As Integer
  Dim st As New Stat_
  i = __xstat(_STAT_VER_LINUX, "/path/of/file", st)
  If i < 0 Then Error.Raise("Error !")
   Print st.st_ino
End
-----------------------------------------------------------------------
1 mar 2023, 19:05 da t.lee.davidson at gmail.com:
> On 3/1/23 11:54, Fabien TONIUTTI wrote:
>
>> Hi every one
>>
>> Is existing one Gambas command to get File inode from its name ?
>>
>> Or reverse ,get name from inode?
>>
>> gb3.18 MINT ext4
>>
>> Thx
>>
>
> There is the Stat command that returns a Stat object. But, that object does not have an Inode property. You would need to use Shell thusly:
> Shell("stat --printf=%i " & [filename] To sOutput
>
> Getting a filename from an inode number can be problematic.
>
>
> -- 
> Lee
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230302/ec13a358/attachment.htm>
    
    
More information about the User
mailing list