| View previous topic :: View next topic |
| Author |
Message |
Patrik Guest
|
Posted: Tue Jun 29, 2004 2:02 pm Post subject: creating directories...? |
|
|
I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
Rgs,
Patrik
|
|
| Back to top |
|
 |
Sharad Kala Guest
|
Posted: Tue Jun 29, 2004 2:24 pm Post subject: Re: creating directories...? |
|
|
"Patrik" <pbohlin (AT) cadence (DOT) com> wrote
| Quote: | I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
|
You need to resort to some platform specific API, standard C++ does not
define it.
|
|
| Back to top |
|
 |
Dario (drinking coffee i Guest
|
Posted: Tue Jun 29, 2004 2:31 pm Post subject: Re: creating directories...? |
|
|
Patrik wrote:
| Quote: | I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
|
In any Posix environment:
#include <unistd.h>
//int mkdir(const char *pathname, mode_t mode);
- Dario
|
|
| Back to top |
|
 |
osmium Guest
|
Posted: Tue Jun 29, 2004 2:40 pm Post subject: Re: creating directories...? |
|
|
Patrik writes:
| Quote: | I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
|
Using system() will give your program pretty much the same powers as a human
would have WRT the operating system. There may be a better way too,
included as part of the API.
|
|
| Back to top |
|
 |
Victor Bazarov Guest
|
Posted: Tue Jun 29, 2004 3:47 pm Post subject: Re: creating directories...? |
|
|
Patrik wrote:
| Quote: | I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
|
There is no OS-independent way because not all OSes have directories.
You should consult your OS programming manual (or book). In most
cases a simple
system("mkdir /home/work/outfiles");
should do it, but what specifically to put in double quotes and what
the effect of that is going to be, is OS-specific.
V
|
|
| Back to top |
|
 |
Prateek R Karandikar Guest
|
Posted: Tue Jun 29, 2004 7:09 pm Post subject: Re: creating directories...? |
|
|
[email]pbohlin (AT) cadence (DOT) com[/email] (Patrik) wrote in message news:<40e55bca.0406290602.589c33d7 (AT) posting (DOT) google.com>...
| Quote: | I know how to read/write files using iostram, but I can't figure out
how to create a directory. Say I wan't to create a directory called
"/home/work/outfiles", how do I do that? I'm running red hat linux.
Rgs,
Patrik
|
"directory" ??? No such thing exists in Standard C++.
-- --
Abstraction is selective ignorance.
-Andrew Koenig
-- --
|
|
| Back to top |
|
 |
|