473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Trying to create a Directory using system call - not working

365 100+
I am trying to create a directory "/log" in linux in below file, it is not creating, I commented windows call and added linux call ro create /log dir.

#define DEFAULT_LOG_DIR "/log"

void main()
{
char dirName[64];

strcpy(dirName, DEFAULT_LOG_DIR);

//_mkdir(dirName) //this is windows mkdir
system("mkdir dirName"); //LINUX

}
Dec 2 '09 #1
6 3600
Markus
6,050 Expert 4TB
You'll need permissions to do that. See libgksu to authenticate your command.
Dec 2 '09 #2
tvnaidu
365 100+
I have permisson, still not able to create /log dir.
Dec 2 '09 #3
RRick
463 Expert 256MB
In linux, the root directory /, is owned and controlled by the root account. You need to be root or have root privileges to create a directory there.

BTW: Try strace with this executable. It should tell you what is happening during the directory creation.
Dec 2 '09 #4
weaknessforcats
9,208 Expert Mod 8TB
Your mkdir needs a string:

"mkdir $/Hello/world/logfile.log"

You are passing "mkdir dirname". Are you nintending to create a direcory named dirname?
Dec 2 '09 #5
tvnaidu
365 100+
I need to create /log directory which I defined with #define.
I have root perm.
Dec 2 '09 #6
RRick
463 Expert 256MB
What does strace tell you?
Dec 2 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Wayne Wengert | last post by:
I am trying to work through an ASP.NET book and in one example you build a Class and then call a method from that class in an ASPX page. I put the class file ("quote.dll") in the bin directory and...
3
by: Kenneth P | last post by:
Hi, I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code ISBN 0-672-32143-2 and is trying to teach myself from examples from this book Chapter 16. Anyway I come quite...
12
by: Ron Weldy | last post by:
I have a test server runinng 2003/IIS 6 with a mixture of asp and asp.net files. On my workstation I have a share set up to the folder where the web files reside. I am just doing quick and dirty...
23
by: sandy | last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory', within my class Directory (Can you already smell disaster?) Each Directory can have subdirectories so I thought to put these...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
14
by: gio | last post by:
I have a problem and the solution should works under windows and unix OS. Suppose I have a program ex.c in the directory X (so the current working directory of ex.c is X). Also suppose I have...
4
by: Vlad | last post by:
I am having problems using the file.create method within a function that is called when looping through an array of filepaths. If I call my function with a hardcoded file path --C:\Temp.txt the...
0
by: rbukkara | last post by:
Hi, I have got the following error while trying to add a user in the LDAP Directory. javax.naming.NameNotFoundException: ; remaining name 'uid=vassila,ou=People,dc=cs,dc=uno,dc=edu' I have...
4
by: =?Utf-8?B?R29yZnk=?= | last post by:
Hey everyone. This is only my first week with C#, but I use actionscript a lot in Flash, so I have a very basic understanding of programming, but bear with me... I am trying to create a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.