PB下我创建完文件以后,却发现文件的属性有时为“只读”。“只读”则我无法写入数据,除非手动修改。
请问各位,PB下如何控制它,去掉“只读”属性?
或者有什么样的API可以让我达到我的目的呢?
急得很啊。苦笑

解决方案 »

  1.   

    SetFileAttributes("pathfile",FILE_ATTRIBUTE_NORMAL)BOOL SetFileAttributes(
      LPCTSTR lpFileName,  // pointer to filename
      DWORD dwFileAttributes   // attributes to set
    );FILE_ATTRIBUTE_NORMAL The file has no other attributes set. This attribute is valid only if used alone. FILE_ATTRIBUTE_READONLY The file is read-only. Applications can read the file but cannot write to it or delete it. 
      

  2.   

    SetFileAttributes("pathfile",FILE_ATTRIBUTE_NORMAL)