LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2011, 11:42 PM   #1
shamjs
Member
 
Registered: Sep 2011
Posts: 88

Rep: Reputation: Disabled
mkdir


Hi all,
im not able to create a directory by using mkdir API

here is my sample debugged information.
Code:
213             string userTemp = std::getenv("HOME");
(gdb)
214             userTemp += "/";
(gdb) p userTemp
$4 = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    _M_p = 0x83a0514 "/home/shamjs"}}
(gdb) n
216             if( userTemp.find_last_of("/\\") != (userTemp.size()-1) )
(gdb)
220             userTemp = userTemp + ".OlupX/";
(gdb)
224             int ret = mkdir(userTemp.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
(gdb) p userTemp
$5 = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
    _M_p = 0x83a079c "/home/shamjs/.OlupX/"}}
(gdb) n
227             if( stempfolder.empty() )
(gdb) p ret
$6 = -1
(gdb) n
230                     stempfolder = userTemp + stempfolder + stream.str();

i dont have any folder by name .OlupX in my home directory

plz suggest me ...

waiting for your reply........
 
Old 12-07-2011, 12:39 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hello,

You marked your thread as solved. Would you please share what you've found out so that others in a similar situation can see if it works for them? Thanks in advance.

Kind regards,

Eric
 
Old 12-07-2011, 12:48 AM   #3
shamjs
Member
 
Registered: Sep 2011
Posts: 88

Original Poster
Rep: Reputation: Disabled
Sure Eric,

i handled the mkdir error message by
Code:
 if(ret==-1)
        {
        printf("error while creating mkdr %s\n",strerror(errno));
        }
then i got error msg as File Exists

since it was an hiden file hence by using ls it has not displayed ,so by using ls -a problem was fixed
 
Old 12-07-2011, 01:15 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

Thank you very much for sharing. Enjoy Linux.

Kind regards,

Eric
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mkdir -p ? shanenin Linux - Software 4 10-19-2011 12:41 PM
how to give options like '-v' for mkdir using system call mkdir() ? nehapawar Linux - Newbie 2 02-05-2010 03:13 AM
MKDIR Error? carlosinfl Linux - General 5 12-08-2006 06:18 PM
mkdir help... Linux~Powered Linux - Software 2 06-13-2004 12:27 PM
mkdir help ITJedi Linux - Software 1 05-14-2004 06:19 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:36 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration