April 24th, 2003, 12:48 PM
when I want to redirect output of a program to a file, why does the file appear as an executable after the data has been written to it? Here is the line that opens the file
April 24th, 2003, 01:52 PM
S_IRWXU means "read, write, execute -- user" and should generate a file mode of 0700.
Read-only for owner is S_IRUSR and write-only is S_IWUSR. You might get the "read & write, but not execute" with (S_IRUSR | S_IWUSR).
Otherwise, you might want to set your umask to mask out the execute (umask == 0111). Or call chmod() to turn executable off.
April 24th, 2003, 01:59 PM
It works I am just using S_IREAD|S_IWRITE.