folder/directories in C

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • smarty

    folder/directories in C

    how to create folders/directories in C. are there any library
    functions for these?
  • Richard Heathfield

    #2
    Re: folder/directories in C

    smarty said:
    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

    Comment

    • soscpd@terra.com.br

      #3
      Re: folder/directories in C

      smarty said:
      >
      how to create folders/directories in C. are there any library
      functions for these?
      You can look after dirent.h (http://www.google.com.br/search?
      hl=en&q=dirent& btnG=Search&met a= /
      http://www.google.com.br/search?hl=e...+Search&meta=).

      Regards
      Rafael

      Comment

      • Mark McIntyre

        #4
        Re: folder/directories in C

        Richard Heathfield wrote:
        smarty said:
        >
        >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.

        --
        Mark McIntyre

        CLC FAQ <http://c-faq.com/>
        CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt >

        Comment

        • Kenneth Brody

          #5
          Re: folder/directories in C

          "soscpd@terra.c om.br" wrote:
          >
          smarty said:

          how to create folders/directories in C. are there any library
          functions for these?
          >
          You can look after dirent.h
          [...]

          Hmm...

          ==========
          C:\temp>type usenet.c
          #include <dirent.h>

          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.

          --
          +-------------------------+--------------------+-----------------------+
          | Kenneth J. Brody | www.hvcomputer.com | #include |
          | kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer .h|
          +-------------------------+--------------------+-----------------------+
          Don't e-mail me at: <mailto:ThisIsA SpamTrap@gmail. com>

          Comment

          • user923005

            #6
            Re: folder/directories in C

            On May 14, 2:26 am, smarty <csmgsa...@gmai l.comwrote:
            how to create folders/directories in C. are there any library
            functions for these?

            Comment

            • CBFalconer

              #7
              Re: folder/directories in C

              user923005 wrote:
              smarty <csmgsa...@gmai l.comwrote:
              >
              >how to create folders/directories in C. are there any library
              >functions for these?
              >
              http://legacy.imatix.com/html/sfl/
              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.


              ** Posted from http://www.teranews.com **

              Comment

              • Antoninus Twink

                #8
                Re: folder/directories in C

                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]

                Comment

                • user923005

                  #9
                  Re: folder/directories in C

                  On May 14, 5:06 pm, CBFalconer <cbfalco...@yah oo.comwrote:
                  user923005 wrote:
                  smarty <csmgsa...@gmai l.comwrote:
                  >
                  how to create folders/directories in C. are there any library
                  functions for these?
                  >>
                  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.

                  Comment

                  • Walter Roberson

                    #10
                    Re: folder/directories in C

                    In article <slrng2pd34.ut0 .nospam@nospam. invalid>,
                    Antoninus Twink <nospam@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>
                    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?

                    A: There were manifold reasons.

                    Comment

                    • Joachim Schmitz

                      #11
                      Re: folder/directories in C

                      Walter Roberson wrote:
                      In article <slrng2pd34.ut0 .nospam@nospam. invalid>,
                      Antoninus Twink <nospam@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>
                      >
                      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()

                      Bye, Jojo


                      Comment

                      • Chris H

                        #12
                        Re: folder/directories in C

                        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 /\/\/\/\/
                        \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



                        Comment

                        • Nick Keighley

                          #13
                          Re: folder/directories in C

                          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?
                          >
                          Yes.
                          >
                          mkdir(2) - create a directory
                          >
                          SYNOPSIS
                           #include <sys/stat.h>
                           #include <sys/types.h>
                          >
                          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

                          --
                          Nick Keighley

                          Comment

                          • thomas.mertes@gmx.at

                            #14
                            Re: folder/directories in C

                            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:

                            #ifdef MKDIR_WITH_ONE_ PARAMETER
                            #define mkdir(NAME,MODE ) mkdir(NAME)
                            #endif

                            and under windows the version.h file contains:

                            #define MKDIR_WITH_ONE_ PARAMETER

                            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.

                            Comment

                            • santosh

                              #15
                              Re: folder/directories in C

                              Nick Keighley wrote:
                              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?
                              >>
                              >Yes.
                              >>
                              >mkdir(2) - create a directory
                              >>
                              >SYNOPSIS
                              >#include <sys/stat.h>
                              >#include <sys/types.h>
                              >>
                              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

                              Working...