Thread: File permissons of new a file

  1. #1
    Registered User
    Join Date
    Mar 2008

    File permissons of new a file

    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 .


  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    -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:
    Quote Originally Posted by man 2 open
    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.
    All the buzzt!

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  3. archive format
    By Nor in forum A Brief History of
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. Making a LIB file from a DEF file for a DLL
    By JMPACS in forum C++ Programming
    Replies: 0
    Last Post: 08-02-2003, 08:19 PM
  5. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 02:58 AM