in reply to Creating file with 777 permission

Yes, assuming the file doesn't already exists. First set the umask to 000, then use 'sysopen' to open the file, with '0777' as the fourth argument.

I'd never do that myself. If I really want to create a file with 0777 permissions, I'd use chmod() after finishing writing the file.