能力值:
( LV9,RANK:380 )
|
-
-
2 楼
local szBuff[156]:DWORD
local Read:DWORD
.
.
invoke lstrlen,addr szBuff
invoke ReadFile,hFile,addr szBuff,eax,addr Read,NULL
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
还是动态分配内存好。
|
能力值:
( LV9,RANK:375 )
|
-
-
4 楼
最初由 pengmo 发布 比如 读出一个文件的所有字节,放到一个局部变量里, 应该怎么写
CFile cfile;
CFileException e;
char* pFileName = "test.dat";
char *pbuf = null;
UINT nBytesRead = 0;
ULONGLONG dwLength = pFile->GetLength();
if( !cfile.Open( pFileName, CFile::modeCreate | CFile::modeWrite, &e ) )
{
TCHAR szError[1024];
ex.GetErrorMessage(szError, 1024);
cout << "Couldn't open source file: ";
cout << szError;
return 1;
}
else
{
dwLength = cfile.GetLength();
pbuf = new char[dwLength];
nBytesRead = cfile.Read( pbuf, dwLength );
}
delete[] pbuf;
cfile.Close();
|
|
|