how to create directory in c++
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 3 123 LastLast
Results 1 to 15 of 31

Thread: how to create directory in c++

  1. #1
    Join Date
    Jul 2005
    Posts
    41

    how to create directory in c++

    i just want to know how to create folders using c++ code...i can make files usng iostream,but can folder?
    i

  2. #2
    Join Date
    May 2005
    Posts
    4,954

    Re: how to create directory in c++

    ::CreateDirectory

    Cheers

  3. #3
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: how to create directory in c++

    Quote Originally Posted by golanshahar
    ::CreateDirectory
    This would only work in Windows...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  4. #4
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: how to create directory in c++

    There is not platform-independent way of doing it...thus, you need to check what the C run-time or API of the correpsonding operating system has to offer...which one are you using?
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  5. #5
    Join Date
    Feb 2005
    Location
    Croatia
    Posts
    192

    Re: how to create directory in c++

    Quote Originally Posted by Andreas Masur
    This would only work in Windows... ;)
    i think that people working in unix/linux wouldnt ask that question ("folders":)
    Last edited by l00p1n6; July 3rd, 2005 at 10:44 AM. Reason: disabled smilies

  6. #6
    Join Date
    Jul 2005
    Posts
    41

    Re: how to create directory in c++

    thanks guys for replaying..
    by the way i m using linux not windows...why would not linux users not ask that?!
    i use mandrake 10.

  7. #7
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: how to create directory in c++

    Quote Originally Posted by l00p1n6
    i think that people working in unix/linux wouldnt ask that question ("folders"
    Why? Aren't there folders in Linux?
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  8. #8
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: how to create directory in c++

    Quote Originally Posted by deepinlife
    thanks guys for replaying..
    by the way i m using linux not windows...why would not linux users not ask that?!
    i use mandrake 10.
    AFAIK, there should be a 'mkdir' function...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  9. #9
    Join Date
    Jun 2002
    Location
    Moscow, Russia.
    Posts
    2,176

    Re: how to create directory in c++

    There is relatively portable boost method create_directory.
    "Programs must be written for people to read, and only incidentally for machines to execute."

  10. #10
    Join Date
    Jun 2002
    Posts
    1,417

    Re: how to create directory in c++

    Quote Originally Posted by Andreas Masur
    Why? Aren't there folders in Linux?
    no respectable *nix programmer would call them "folders". They are directories.

  11. #11
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652

    Re: how to create directory in c++

    Quote Originally Posted by stober
    no respectable *nix programmer would call them "folders". They are directories.
    Well...I guess that I does not have that much respect for my *nix then (IOW, my directories can be folders if they want)...
    Ciao, Andreas

    "Software is like sex, it's better when it's free." - Linus Torvalds


    Article(s): Allocators (STL) Function Objects (STL)

  12. #12
    Join Date
    Nov 2005
    Posts
    1

    Question Re: how to create directory in c++ - on Linux

    Quote Originally Posted by golanshahar
    ::CreateDirectory

    Cheers

    Is ::CreateDirectory a Windows specific function? How to create directory using C++ on Linux?

    Are there any C++ functions available (that create directory on Linux) written by someone who would like to share to others?

    o/w; Is there a built-in C++ function that creates directory and will runs on Linux (no Windows specific stuff?

    Thanks!

    Windy

  13. #13
    Join Date
    Aug 2002
    Location
    Madrid
    Posts
    4,588

    Re: how to create directory in c++

    Quote Originally Posted by RoboTact
    There is relatively portable boost method create_directory.
    RoboTact has already given the answer. Use boost::filesystem and you'll have the bonus of having OS independent code.
    Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
    Supports C++ and VB out of the box, but can be configured for other languages.

  14. #14
    Join Date
    Jun 2002
    Posts
    1,417

    Re: how to create directory in c++

    Andres also posted a function that is portable between *nix and MS-Windows -- mkdir().

  15. #15
    Join Date
    Jun 2008
    Posts
    6

    Re: how to create directory in c++

    i had to create directories in windows using VC++
    I can get CreateDirectory to work only when the path is like " c:/face"
    If I give "c:/face/images" it doesnt create the folder, not even face, any help would be appreciated.

    if I have c:/face created then it creates ./image also :?

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center