File permissons of new a file [Archive] - C Board

PDA

View Full Version : File permissons of new a file


vlrk
03-28-2008, 07:26 AM
Hello guys,

i created a new file useing a program like below


#include <stdio.h>
#include <fcntl.h>

int main()
{
int fileStatus;

fileStatus = open("temp.txt",O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT);

printf("%d \n",fileStatus);

return 0;


}



after executing this program . when i do the ls -l it shows as below

-rw-rwx--T 1 rama rama 0 Mar 28 18:44 temp.txt

do any body know what is this "T" means .

regards

CornedBee
03-28-2008, 09:01 AM
-rw-rwx--? That alone is weird and should give you a clue.
Your problem is that you specify O_CREAT but don't follow this little sentence in the manpage:
mode must be specified when O_CREAT is in the flags, and is ignored otherwise.

Your flags to open() don't make sense either. You open the file only for reading and only for writing and for reading and writing? These three flags are mutually exclusive.