mkdir() question

This is a discussion on mkdir() question within the C Programming forums, part of the General Programming Boards category; I'm trying to make a user defined directory, so I get a string from the user, but then how do ...

  1. #1
    Electrical Engineer
    Join Date
    Feb 2005
    Posts
    3

    mkdir() question

    I'm trying to make a user defined directory, so I get a string from the user, but then how do I correctly use the mkdir() function to use a string as an argument, and then handle the proper permissions.
    oh, it's on a linux box...

    right now I think (don't have the code with me right now) I have it like this;

    mkdir(dirstring);

    and that is making the proper directory now, but it is only accessbile from root. how do I tell it to give all permissions to users?
    I have looked at the usage of chmod and such, and seem to have a basic understanding of how to handle permissions, but it's more a question of syntax, and how I use this in the mkdir function...

    Thanks

  2. #2
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,159
    mkdir() actually expects 2 arguments. Guess what the second one is...

    man pages are an excellent resource. Try the one for mkdir():
    http://www.hmug.org/man/2/mkdir.html
    If you understand what you're doing, you're not learning anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Alice....
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 06-20-2005, 02:51 PM
  2. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  3. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  4. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 12:47 AM

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