473,810 Members | 3,102 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

making a directory

hi everyone,
i want to create a folder on the harddisk using c program.
the folder is infact a nested folder like sec1\subsec22\s ubsec9
to be created in c:\ drive.
I tried the following statement
mkdir ( c:\\sec1\\subse c22\\subsec9);
but it does not work.

the 'system' command system("md sec1\\subsec22\ \subsec9")
is also not working.

Please help whether there is some problem in syntax or some special
setting is to be done prior to using the 'system' command.

Is there any alternative by which i can create the folder.

Note that neither mkdir nor rmdir is working with such a path.

Jun 24 '07 #1
3 1894
Gurpreet Singh wrote:
hi everyone,
i want to create a folder on the harddisk using c program.
the folder is infact a nested folder like sec1\subsec22\s ubsec9
to be created in c:\ drive.
I tried the following statement
mkdir ( c:\\sec1\\subse c22\\subsec9);
but it does not work.
While off topic, the answer is simple: create the path one level at a time.

--
Ian Collins.
Jun 24 '07 #2
Gurpreet Singh wrote:
hi everyone,
i want to create a folder on the harddisk using c program.
the folder is infact a nested folder like sec1\subsec22\s ubsec9
to be created in c:\ drive.
I tried the following statement
mkdir ( c:\\sec1\\subse c22\\subsec9);
but it does not work.

the 'system' command system("md sec1\\subsec22\ \subsec9")
is also not working.

Please help whether there is some problem in syntax or some special
setting is to be done prior to using the 'system' command.

Is there any alternative by which i can create the folder.

Note that neither mkdir nor rmdir is working with such a path.
in addition to the Ian's suggestion to create them one at time, take a
look to boost::filesyst em
(http://www.boost.org/libs/filesystem/doc/index.htm)

Regards,

Zeppe

Jun 24 '07 #3
Zeppe wrote:
in addition to the Ian's suggestion to create them one at time, take a
look to boost::filesyst em
(http://www.boost.org/libs/filesystem/doc/index.htm)
Another option, if you are content using the POSIX standard (which
IMO is ok if you are just making a program for yourself, or for
distributing for POSIX-compliant systems, ie. most unix systems):

http://swoolley.org/man.cgi/2/mkdir
Jun 24 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2828
by: Willam Roberts | last post by:
To me, when you enumerate, you make a list of specific items, like enumerating controls in a form. Am I missing something? I mean is there something more to the meaning of the term "enumeration" or "enumerate" (in programming context) other than just sounding technical. i.e. is it more than just making a list of items? Are they the same thing? Please excuse my 'dah' factor, but it is really bugging me. Willam Roberts Joy to the world
0
1166
by: lamar_air | last post by:
I have a python cgi that i wrote. The way it works is a user fills out necessary information on a web form, click submit and the python script is executed. The script retrieves variables from the form and writes them to a txt file. The script then calls a executable which uses this txt file as a set of input parameters. I'm using this to call the executable os.system("webtablx4002") and then i just added webtablx4002 at...
8
1855
by: McGrull | last post by:
Sorry for my question, but I'm really a newbie on ASP. I need to make a simple page (for IIS 5.0 and up, but even for 2000 Professional IIS) that read and display the files contained in a specified directory and next, clicking on one of them, calling and making an action with an another ASP page. For example: http://server/list.asp Listing Y:\REPOSITORY
7
5432
by: Wysiwyg | last post by:
Is there any way to add an embedded resource to a project without copying it to the project's directory? I have shared resources and don't want each project using the images, xml files, etc. to need to be updated with the current copy before being built. I also don't want projects being built with the old copy. Thanks! Bill
2
1036
by: Husam | last post by:
Hi EveryBody: I create directory by using the general formula that is : Directroy.CreateDirctroy("C:\windows98") and I want to make this dirctroy out of reach, I dont want any body to find it, so I use file attributes to hide it, but as you know any one can go to tools menu and go to folder option and choose show hidden files this option will show my directory.
2
1954
by: lucifer | last post by:
hi i am making an http server it has following functions main() { if option is "-?", output the hints and stop check the directory supplied is sensible and not a security risk become a daemon process ignore child programs (to avoid zombies when child processes stop)
5
8024
by: yenra | last post by:
Can anyone help me in making this program?!... I need to make a telephone directory using structure definition.. typedef struct AddressTag{ char surname; char givenname; char middleinitial; char telnum; struct PersonTag *next;
10
3182
by: mrkcse | last post by:
I have choosed wise installation system 9.0 for making setup file of my vb6 application It is giving following error while creating setup " the following dependency files are referenced in the project file but cannot be located on your computer.If files are located in different directory you can copy into system or system32 directory." in check boxes following dependency files it is showing conf.dep
2
1574
by: nothing1 | last post by:
Here is my code and what it does is create a page for every directory with the contents of choice. Its been working on all letters except "u" I can't seem to figure it out. Does someone see the flaw that I'm not seeing? <?php $dir_build = "../data/pages/"; $inside = array("0-9","A","B","C","D","E","F","G","H","I","J","K","L","M", "N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
0
2522
by: libish | last post by:
hi all, can any one help me in converting a directory to read only format. and also making a read only directory/file to read/write directory this is to avoid deleting a directory accidently.. my project is for windows mobile and is in c#.
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10379
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10124
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3863
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.