Click here to Skip to main content
Rate this: bad
good
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
Comments
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".
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Check this link ->
 
Creating directory in vc++[^]
  Permalink  
Comments
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.
--SA
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
SHCreateDirectoryEx.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

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

Solution 2

Using Win32 API:
GetFileAttributes
- to check if directory exists, then
CreateDirectory
- 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.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 290
1 Jochen Arndt 165
2 DamithSL 125
3 PIEBALDconsult 110
4 Garth J Lancaster 90
0 OriginalGriff 5,790
1 DamithSL 4,601
2 Maciej Los 4,012
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,195


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 14 Oct 2013
Copyright © CodeProject, 1999-2014
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