CFile dibFile(filename,CFile::modeWrite|CFile::modeCreate);
這里第二個引數為什么要寫成CFile::modeWrite|CFile::modeCreate?不懂是啥意思,請指教~
uj5u.com熱心網友回復:
https://msdn.microsoft.com/en-us/library/cz0a83sb(v=vs.80).aspxuj5u.com熱心網友回復:
檔案如果未創建就創建 如果已存在就不創建 后面write么是代表可以往里面寫操作
uj5u.com熱心網友回復:
class CFile : public CObject{
DECLARE_DYNAMIC(CFile)
public:
// Flag values
enum OpenFlags {
modeRead = 0x0000,
modeWrite = 0x0001,
modeReadWrite = 0x0002,
shareCompat = 0x0000,
shareExclusive = 0x0010,
shareDenyWrite = 0x0020,
shareDenyRead = 0x0030,
shareDenyNone = 0x0040,
modeNoInherit = 0x0080,
modeCreate = 0x1000,
modeNoTruncate = 0x2000,
typeText = 0x4000, // typeText and typeBinary are used in
typeBinary = (int)0x8000 // derived classes only
};
enum Attribute {
normal = 0x00,
readOnly = 0x01,
hidden = 0x02,
system = 0x04,
volume = 0x08,
directory = 0x10,
archive = 0x20
};
enum SeekPosition { begin = 0x0, current = 0x1, end = 0x2 };
enum { hFileNull = -1 };
就是CFile 定義的 列舉
uj5u.com熱心網友回復:
uj5u.com熱心網友回復:
CFile::modeCreate Directs the constructor to create a new file. If the file exists already, it is truncated to 0 length.創建新檔案。如果檔案已經存在,它將被截斷為0長度CFile::modeWrite Opens the file for writing only.
uj5u.com熱心網友回復:
請參考MSDN檔案說明~轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/105201.html
標籤:基礎類
