你好:
    我想自己做一个安装程序,当指定的路径不存在时需要程序能够自己创建这些文件夹,请问怎么样实现呢?还有一个小问题:如何用程序把一个属性为只读的文件夹(已经存在于系统中)修改为属性为可读写?谢谢

解决方案 »

  1.   

    Create a new directory.int _mkdir(
       const char *dirname 
    );
    int _wmkdir(
       const wchar_t *dirname 
    );
    Parameter
    dirname 
    Path for new directory. 
    Return Value
    Each of these functions returns the value 0 if the new directory was created. On an error the function returns –1 and sets errno as follows: EEXIST 
    Directory was not created because dirname is the name of an existing file, directory, or device. 
    ENOENT 
    Path was not found. 
      

  2.   

    GetFileAttributes
    然后BOOL SetFileAttributes(
      LPCTSTR lpFileName,
      DWORD dwFileAttributes
    );具体用法看MSDN
      

  3.   

    BOOL CreateDirectory(
      LPCTSTR lpPathName,                         // pointer to directory path string
      LPSECURITY_ATTRIBUTES lpSecurityAttributes  // pointer to security descriptor
    );
      

  4.   

    CFileFind ff;
    if (!ff.FindFile("c:\\远程支援系统\\*.*")) 
    CreateDirectory("c:\\远程支援系统\\", NULL);
      

  5.   

    用CreateDirectory,还不明白就找一本Windows API的书看看吧,这个也是API函数
      

  6.   

    CreateDirectory((LPCTSTR)“目录名”,NULL);
      

  7.   

    可以不用自己创建,参考 MakeSureDirectoryPathExists 这个API,创建你指定的所有目录。
      

  8.   

    CreateDirectory((LPCTSTR)“目录名”,NULL);