Create folders using C++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reon
    New Member
    • Feb 2007
    • 80

    Create folders using C++

    While we can create files using c++...
    Is there any code relating to create folders in c++..
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    It depends on the environment you are working in (Windows, Linux, etc.)

    Comment

    • reon
      New Member
      • Feb 2007
      • 80

      #3
      i am using windows and compiler as turbo c++...

      Comment

      • rajesh6695
        New Member
        • Oct 2006
        • 96

        #4
        One way is using system call...
        system("md scripts");

        Comment

        • reon
          New Member
          • Feb 2007
          • 80

          #5
          Originally posted by rajesh6695
          One way is using system call...
          system("md scripts");
          if u dont mind please illustrate it with an example...
          you mean fstream.h

          Code:
          ifstream ifil("filename.txt");
          i think the above code only works for creating file and inputing it into files..
          shall we make folders via ifstream please specify....

          Comment

          • horace1
            Recognized Expert Top Contributor
            • Nov 2006
            • 1510

            #6
            Originally posted by reon
            if u dont mind please illustrate it with an example...
            you mean fstream.h

            Code:
            ifstream ifil("filename.txt");
            i think the above code only works for creating file and inputing it into files..
            shall we make folders via ifstream please specify....
            rajesh6695 is talking about the system() function


            which passes a command to the operating system (as though you typed it at the command line)
            Code:
                system("dir *.c");                                         /* call system */
                printf("parent program resumed");
            in the above example the parent program is suspended, dir *.c executed and the parent program resumed. You could do a similar thing with the mkdir command

            Comment

            Working...