如何創建文本文件?visual C++創建文本文件
CreateFile("1",
GENERIC_READ | GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_FLAG_OVERLAPPED,
NULL);
擲
1> ------構建開始:項目:TEST2,配置:調試的Win32 ------ 1>測試2.cpp 1> C: \ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(126):error C2065:'GENERIC_READ':未聲明的標識符 1> c:\ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(126):error C2065:'GENERIC_WRITE':未聲明的標識符 1> c:\ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(128):錯誤C2065: 'NULL':未聲明的標識符 1> c:\ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(129):error C2065:'CREATE_NEW':未聲明的標識符 1> c:\用戶\kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(130):error C2065:'FILE_FLAG_OVERLAPPED':未聲明的標識符 1> c:\ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(131):error C2065:'NULL':未聲明的標識符 1> c:\ users \kredkołamacz\ documents \ visual studio 2010 \ projects \ test2 \ test2 \ Form1.h(125) C3861:'CreateFile':標識符未找到 ==========構建:0成功,1失敗,0最新,0跳過==========
我想你需要包含CreateFile() - WinBase.h(包括Windows.h)的頭文件 - 從http://msdn.microsoft.com/en-us/library/aa363858%28VS.85% 29.aspx – Tim 2010-10-06 15:13:01