set the read only attribute of the specified file.
"file" - the file to set the read only attribute for.
Returns the filename if the operation was successful, otherwise $null is returned.
createNewFile("blah.txt"); if (-canwrite "blah.txt") { print("Yeap, we can write it..."); setReadOnly("blah.txt"); println(" not any more!"); } $handle = openf(">blah.txt"); if (checkError($error)) { println("Could not open blah.txt for writing: $error"); } else { println($handle, "wheee"); closef($handle); }
Yeap, we can write it... not any more! Could not open blah.txt for writing: java.io.FileNotFoundException: blah.txt (Permission denied)