func_file_filemode.rst 807 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. .. _func_file_filemode:
  2. ========
  3. FileMode
  4. ========
  5. FileMode -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. FileMode( path$ )
  10. Get file mode
  11. Parameters
  12. ==========
  13. Return Values
  14. =============
  15. file mode flags
  16. Examples
  17. ========
  18. .. code-block:: blitzmax
  19. ' filemode.bmx
  20. ' the following function converts the file mode to
  21. ' the standard unix permission bits string
  22. Function Permissions$(mode)
  23. local testbit,pos
  24. local p$="rwxrwxrwx"
  25. testbit=%100000000
  26. pos=1
  27. while (testbit)
  28. if mode & testbit res$:+mid$(p$,pos,1) else res$:+"-"
  29. testbit=testbit shr 1
  30. pos:+1
  31. wend
  32. return res
  33. End Function
  34. print Permissions$(filemode("filemode.bmx"))
  35. See Also
  36. ========