creating a folder in borland c++

A

akidhead

hi people,
i have a problem, i want to create a folder on my machine, whenever i
save my configuration.
the folder is created with folder name as "current username" is it
possible to do it in C++,
i have done it with C#, but have no clue how to do it here.
 
R

Robert Bauck Hamar

hi people,
i have a problem, i want to create a folder on my machine, whenever i
save my configuration.

What does 'save my configuration' mean?
the folder is created with folder name as "current username" is it
possible to do it in C++,

Probably. If your OS supports folders, it is usually some means to create
them. But there exists no means of doing it using only standard C++
functions. On my system, I could use

#include <string>
#include <iostream>
#include <ostream>
#include <sys/stat.h> //nonstandard header
#include <sys/types.h> //nonstandard header

....

std::string dirname = "something";
if (mkdir(dirname.c_str(), ~mode_t(0)) == 0) {
std::cout << dirname << " created\n";
}

mkdir is a nonstandard function, and mode_t is a nonstandard type. But what
you actually use on your system, may be different. Look in the
documentation for your compiler and/or your operating system. There is also
several groups dedicated to programming on different platforms. You might
try one of these.
 
A

akidhead

What does 'save my configuration' mean?


Probably. If your OS supports folders, it is usually some means to create
them. But there exists no means of doing it using only standard C++
functions. On my system, I could use

#include <string>
#include <iostream>
#include <ostream>
#include <sys/stat.h> //nonstandard header
#include <sys/types.h> //nonstandard header

...

std::string dirname = "something";
if (mkdir(dirname.c_str(), ~mode_t(0)) == 0) {
std::cout << dirname << " created\n";

}

mkdir is a nonstandard function, and mode_t is a nonstandard type. But what
you actually use on your system, may be different. Look in the
documentation for your compiler and/or your operating system. There is also
several groups dedicated to programming on different platforms. You might
try one of these.

i am using windows, it does support folders.
well, forget about the "configuration" i just want to know how to
create a folder.
will try this and let you know.
thanks!
 
V

Victor Bazarov

[..].
i am using windows, it does support folders.
well, forget about the "configuration" i just want to know how to
create a folder.
will try this and let you know.

Don't let us know. We couldn't care less. OS-specific functionality
is discussed in the newsgroup dedicated to that OS, and *not here*.

V
 
A

akidhead

[..].
i am using windows, it does support folders.
well, forget about the "configuration" i just want to know how to
create a folder.
will try this and let you know.

Don't let us know. We couldn't care less. OS-specific functionality
is discussed in the newsgroup dedicated to that OS, and *not here*.

V

i did not ask for that, kumar asked me about OS, so i replied, i know
thi is C++ group and my doubt was about C++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top