In c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • arijit786
    New Member
    • Oct 2007
    • 2

    In c++

    How to create a directory and create a file in a particular directory in c++?
  • RRick
    Recognized Expert Contributor
    • Feb 2007
    • 463

    #2
    You have two different questions.

    How to make a directory in C++? C++ doesn't have that capability. You'll have to find a subroutine supplied by your operating system. In Linux, you use mkdir. In windows, I don't know.

    How to make a file in a directory in C++? C++ can do this. You specify the path and directory name and pass that complete name to the ofstream object. The default open options of ofstream will create a file for you if it doesn't exist.

    Ofstream will not create a directory for you. You need to make sure the directory is created before creating the file.

    Comment

    Working...