SetFileMode

BlitzMax Forums/BlitzMax Programming/SetFileMode

Rimmsy(Posted 2005) [#1]
Hi guys, does anyone have an explanation as how to use this? The example isn't very helpful unless you just want to set the file to read-only.

Anyone got an example of what all the bits do?


tonyg(Posted 2005) [#2]
They seem to be the unix rwx filemodes. See getfilemode. UNIX filemode is user,group,all.


Rimmsy(Posted 2005) [#3]
Oh, I see. so the bits are:

user group all
rwx rwx rwx

where:
r=read
w=write
x=execute

so if you wanted to make the file read-only for everyone you'd do:

setFileMode("data.txt",%000000111)

Anyone know how to make a file hidden?

That right?


tonyg(Posted 2005) [#4]
That would make the file read, write and execute for everybody EXCEPT the user and group who wouldn't have any access.
To make it read-only you'd have to set 'everybody' to 100
Doesn't seem to do anything under windows though.
Not sure how to make a file hidden.


xlsior(Posted 2005) [#5]
Read only for the user, those in the same group and everyone else would be 100100100.

Setting it to 000000100 would mean that the user and those in his group are explicitely denied read, write and execute, and it would be read-only for everyone else.


Rimmsy(Posted 2005) [#6]
I see. Thanks guys. Anyone got the heads up on making a file invisible like a ninja?