Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <string>
- #include "Shlwapi.h"
- using namespace std;
- int main()
- {
- string path = "C:\\Users\\devgru\\Desktop\\1";
- CreateDirectory(path.c_str(), NULL);
- if(DirectoryExist(path.c_str()) == true){
- cout << "Create succes !!";
- }
- //CopyFile("C:\\Users\\devgru\\Desktop\\1\\test.txt", "C:\\Users\\devgru\\Desktop\\2\\test.txt", TRUE);
- cout << "Copy succes !!";
- return 0;
- }
- bool dirExists(const string& dirName_in)
- {
- DWORD ftyp = GetFileAttributesA(dirName_in.c_str());
- if (ftyp == INVALID_FILE_ATTRIBUTES)
- return false; //something is wrong with your path!
- if (ftyp & FILE_ATTRIBUTE_DIRECTORY)
- return true; // this is a directory!
- return false; // this is not a directory!
- }
- BOOL DirectoryExists(LPCTSTR szPath)
- {
- DWORD dwAttrib = GetFileAttributes(szPath);
- return (dwAttrib != INVALID_FILE_ATTRIBUTES &&
- (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
- }
- BOOL DirectoryExist(const char* dirName) {
- DWORD attribs = ::GetFileAttributesA(dirName);
- if (attribs == INVALID_FILE_ATTRIBUTES) {
- return false;
- }
- return (attribs & FILE_ATTRIBUTE_DIRECTORY);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement