Click here to Skip to main content
11,484,941 members (71,689 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: VC8.0
How to create folders and sub folders in vc++? It should first check whether the current folder exists or not, if it exists, then the same folder may be used, else new folder has to be created? for instance: Images\\IpAddress\\image1.jpeg.
Please help me...
Posted 25-May-11 19:18pm
SAKryukov at 26-May-11 1:34am
"Folder" is rather a metaphor for UI and for the users, at the API level this is "Directory".
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Check this link ->

Creating directory in vc++[^]
Laxmikant_Yadav at 26-May-11 0:51am
My +5 : Nice Link
SP 24 at 26-May-11 0:54am
Thanks Laxmikant :)
SAKryukov at 26-May-11 1:33am
Agree, a 5.
SP 24 at 26-May-11 1:35am
Thanks SAKryukov :)
Gokulnath007 at 26-May-11 5:40am
How to check whether it is already exists or not, if it exists, leave it as such, if it doesnt exists,then it should be created
SP 24 at 26-May-11 6:33am
Did you check the MSDN link and properly read it ?? No
If you are using SHCreateDirectoryEx, CreateDirectory and your directory is already exist than you receive an error message: ERROR_FILE_EXISTS.
If you want to create file recursively than use
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You can use CreateDirectory(szDirPath,NULL) to create a directory.
Gokulnath007 at 22-Oct-13 7:01am
Thank u preethi...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Using Win32 API:
- to check if directory exists, then
- to create directory if needed.

This is the MSDN article with sample using both functions.
This is codeproject solution to help you.
Good luck,
Sergey Chepurin.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 190
1 Sergey Alexandrovich Kryukov 160
2 Raje_ 155
3 OriginalGriff 137
4 Mehdi Gholam 130
0 Sergey Alexandrovich Kryukov 8,494
1 OriginalGriff 7,948
2 Sascha Lefèvre 3,199
3 Maciej Los 2,681
4 Richard Deeming 2,370

Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 14 Oct 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100