how to create folders/directories in C. are there any library
functions for these?
Yes, of course, but the exact details differ from one implementation to
another - there is no standard function to do this. I suggest asking in a
group that deals specifically with your implementation or, at least, your
platform.
--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
>how to create folders/directories in C. are there any library
>functions for these?
>
Yes, of course, but the exact details differ from one implementation to
another - there is no standard function to do this. I suggest asking in a
group that deals specifically with your implementation or, at least, your
platform.
And if all else fails system() can generally be used to invoke whatever
OS-level command you'd type in by hand to create a folder.
C:\temp>cl /c usenet.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
usenet.c
usenet.c(1) : fatal error C1083: Cannot open include file: 'dirent.h': No
such file or directory
C:\temp>
==========
As Mr. Heathfield has already said -- there is no standard C method.
However, there are plenty of platform-specific methods available on
platforms which have "folders/directories". You need to check the
platform-specific documentation, or ask in a newsgroup where such
discussions are topical, for answers.
Bad answer. There are no specifications for folders or directories
in the C standard, therefore anything to do with such items is
system specific and thus off-topic here. Try comp.unix.progr ammer.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home .att.net>
Try the download section.
DESCRIPTION
mkdir() attempts to create a directory named pathname.
The parameter mode specifies the permissions to use. It is modified
by the process’s umask in the usual way: the permissions of the
created directory are (mode & ~umask & 0777).
[snip]
>
Bad answer. There are no specifications for folders or directories
in the C standard, therefore anything to do with such items is
system specific and thus off-topic here. Try comp.unix.progr ammer.
The above link is a wrapper for various operating systems to be able
to perform in a system independent way things like "create a folder"
"find a file" "iterate over a directory"
The pedagogic answer of sending people to news:comp.sourc es.wanted
simply doesn't work.
Any time you see that a routine requires an include file whose
name has a '/' in it, you know that the routine is not part of the
standard C library.
--
Q: Why did the chicken cross the Mobius strip?
>
Any time you see that a routine requires an include file whose
name has a '/' in it, you know that the routine is not part of the
standard C library.
True, but that has been said elsethread numerous times already.
The OP blatantly obiously is using a platform that does suppert a filesystem
and directories, otherwise (s)he wouldn't have aske that question, would he?
So his platform will have means to create directories and the best bet is
POSIX's mkdir()
In message
<2879be69-1495-4cb8-aa4e-fc65416b7a0c@v2 6g2000prm.googl egroups.com>,
smarty <csmgsarma@gmai l.comwrites
>how to create folders/directories in C. are there any library
>functions for these?
What platform are you on?
DO you have an OS?
If so what is it?
If not what is the target MCU and the compiler?
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
Any time you see that a routine requires an include file whose
name has a '/' in it, you know that the routine is not part of the
standard C library.
>
True, but that has been said elsethread numerous times already.
The OP blatantly obiously is using a platform that does suppert a filesystem
and directories, otherwise (s)he wouldn't have aske that question, would he?
So his platform will have means to create directories and the best bet is
POSIX's mkdir()
On 16 Mai, 00:08, Antoninus Twink <nos...@nospam. invalidwrote:
On 14 May 2008 at 9:26, smarty wrote:
>
how to create folders/directories in C. are there any library
functions for these?
>
Yes.
>
mkdir(2) - create a directory
>
SYNOPSIS
#include <sys/stat.h>
#include <sys/types.h>
>
int mkdir(const char *pathname, mode_t mode);
>
DESCRIPTION
mkdir() attempts to create a directory named pathname.
>
The parameter mode specifies the permissions to use. It is modified
by the process’s umask in the usual way: the permissions of the
created directory are (mode & ~umask & 0777).
[snip]
There is also a windows version of mkdir, but it has only
one parameter (the file name). What I use is:
That way mkdir works under unix/bsd/linux and windows.
Greetings Thomas Mertes
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
On 16 May, 07:36, "Joachim Schmitz" <nospam.j...@sc hmitz-digital.de>
wrote:
>Walter Roberson wrote:
In article <slrng2pd34.ut0 .nos...@nospam. invalid>,
Antoninus Twink <nos...@nospam. invalidwrote:
>On 14 May 2008 at 9:26, smarty wrote:
>>how to create folders/directories in C. are there any library
>>functions for these?
Any time you see that a routine requires an include file whose
name has a '/' in it, you know that the routine is not part of the
standard C library.
>>
>True, but that has been said elsethread numerous times already.
>The OP blatantly obiously is using a platform that does suppert a
>filesystem and directories, otherwise (s)he wouldn't have aske that
>question, would he? So his platform will have means to create
>directories and the best bet is POSIX's mkdir()
>
why not Win32
It's relatively less portable than the POSIX functions. Windows
implements mkdir but Unix systems don't implement Win32 system calls.
You'll have to run under WINE. Of course if the OP is using a mainframe
or some other system, then neither option will make sense.
Comment