leo liu
April 16th, 1999, 03:37 AM
Windows NT/98
VC 6.0
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HANDLE m_hFile=CreateFile("c:\\cvl.log",GENERIC_WRITE,0,NULL,
OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
SetFilePointer(m_hFile,0,0,FILE_END);
char sztemp[256]="132.147.70.1,,1999-4-16 15:57:18,1999-4-16 15:57:35";
DWORD dwSize;
for(dwSize=0;sztemp[dwSize];dwSize++);
WriteFile(m_hFile,sztemp,dwSize-1,NULL,NULL);
CloseHandle(m_hFile);
return 0;
}
When this code ,it cause an exception(access violation).The following is the error information.
"First-chance exception in test1.exe (KERNEL32.DLL): 0xC0000005: Access Violation."
Who can help me?
VC 6.0
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HANDLE m_hFile=CreateFile("c:\\cvl.log",GENERIC_WRITE,0,NULL,
OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
SetFilePointer(m_hFile,0,0,FILE_END);
char sztemp[256]="132.147.70.1,,1999-4-16 15:57:18,1999-4-16 15:57:35";
DWORD dwSize;
for(dwSize=0;sztemp[dwSize];dwSize++);
WriteFile(m_hFile,sztemp,dwSize-1,NULL,NULL);
CloseHandle(m_hFile);
return 0;
}
When this code ,it cause an exception(access violation).The following is the error information.
"First-chance exception in test1.exe (KERNEL32.DLL): 0xC0000005: Access Violation."
Who can help me?