setting file permissions

This is a discussion on setting file permissions within the C Programming forums, part of the General Programming Boards category; Hello all, So I recently joined the Linux community but am still learning the differences between it and Windows. At ...

  1. #1
    Registered User
    Join Date
    Nov 2005
    Location
    Alpine, TX
    Posts
    31

    setting file permissions

    Hello all,
    So I recently joined the Linux community but am still learning the differences between it and Windows. At this point in my project I am just getting a users input of a file that he/she wants to open to write to. The testing to see if the file entered exists or not seems to be working ok. However instead of just returning an error if the file does not exist i want to create it. That seems to be working almost fine. The file that I create becomes locked and not usable. Im guessing because im not in root mode. But I would like the file to be used by anyone. How would I set the permissions for this so that it is usable to write to immediately?

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    You could always post some code and some error messages.

    Being root (or otherwise) has nothing to do with it BTW.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    >The file that I create becomes locked and not usable
    If your program created the file through fopen. And you are the current user who executed the code. Then you will the owner of that file. As mentioned before it has nothing to do with root. And how do you say that the file has been locked.

    Its like this. When you create a file. You will get the read/write access and all other will get read access to that code expect root.

    Did you get any error message. Post your code.

    ssharish

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  3. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  4. setting numerical file permissions with open
    By rotis23 in forum C Programming
    Replies: 2
    Last Post: 11-08-2002, 05:42 AM
  5. Hmm....help me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21