-
June 11th, 2003, 12:20 PM
#1
Creating a Directory
Is there a certain command that will allow you to create a new directory?
I want the user to enter a name of a directory, and when he clicks "create directory" it makes a directory.
For example if he typed "pictures", it would get the current path name and then create a folder called "pictures".
-
June 11th, 2003, 12:36 PM
#2
One solution is CreateDirectory().
Kuphryn
-
June 11th, 2003, 05:48 PM
#3
One more way is to
#include <direct.h>
_mkdir( strDirectoryPath );
- Chetan.
-
November 12th, 2020, 09:28 PM
#4
Re: Creating a Directory
I am not able to create a directory having the following time and date format "Data – MM/DD/YYYY - HH:MM:SS".
It fails when we have characters like "/" and ":" in the directory name. any idea how to resolve this.
-
November 12th, 2020, 11:28 PM
#5
Re: Creating a Directory
Originally Posted by vcdebugger
I am not able to create a directory having the following time and date format "Data – MM/DD/YYYY - HH:MM:SS".
It fails when we have characters like "/" and ":" in the directory name. any idea how to resolve this.
All operating systems have restrictions around what are valid file path characters. If / and : aren't allowed, don't use them, and replace them with something else.
-
November 14th, 2020, 02:40 PM
#6
Re: Creating a Directory
Originally Posted by vcdebugger
I am not able to create a directory having the following time and date format "Data – MM/DD/YYYY - HH:MM:SS".
It fails when we have characters like "/" and ":" in the directory name. any idea how to resolve this.
Slashes are used as directory delineators in a path name. It's not reasonable to expect to be able to use them as part of a directory name.
-
November 14th, 2020, 05:27 PM
#7
Re: Creating a Directory
Originally Posted by GCDEF
Slashes are used as directory delineators in a path name. ...
... as well as colons that are used as the "drive" delimiters ...
Last edited by VictorN; November 15th, 2020 at 04:44 AM.
Reason: typo
Victor Nijegorodov
-
November 15th, 2020, 04:31 AM
#8
Re: Creating a Directory
Colon is also used to name an alternate NTFS file stream. See http://www.flexhex.com/docs/articles...-streams.phtml
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|