Everyone wants to know that the CreateDirectory () API function in Windows is used to create a directory, but the function is still limited, that is, it can only create a single-layer directory. We often create multi-layer directories when writing applications. Here is a program that creates a multi-layer directory, I hope to help everyone.
Bool CreateMultiPEDirectory (const char * pszdir) {std :: string strdir (pszdir); // Store to create a directory string std :: vector
Std :: string :: const_iterator siter; // Defines the string iterator // Traverse to create the string for (SITER = STRDIR.BEGIN (); SITER! = strdir.end (); SITER ) {if (* siter ! = '//') {// If the current character is not '/' strTemp = (* SITER);} else {// If the current character is '//' vPath.push_back (strTemp); // will currently The string of the layer is added to the array strTemp = '//';}}
// Traverse the array of stored directories, create each layer of directory std :: vector
Return bsuCcess;}
This is a little summary in the work. If you don't have any article, please share it with you, I hope everyone should not laugh! :) If there is any omission, please give you a two!