Click here to Skip to main content
11,704,315 members (45,822 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 18: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 Sergey Alexandrovich Kryukov 740
1 OriginalGriff 520
2 Maciej Los 355
3 Andy Lanng 284
4 CPallini 275
0 OriginalGriff 8,824
1 Sergey Alexandrovich Kryukov 8,247
2 CPallini 5,197
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web04 | 2.8.150819.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