能力值:
( LV5,RANK:70 )
|
-
-
2 楼
if( argc < 2 ) { printf("usage: %s %s/n", argv[0], "infile"); exit(1); }
HANDLE hFile = CreateFile(argv[1], GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
你为什么要给argv[1]加&呢?
|
能力值:
( LV2,RANK:15 )
|
-
-
3 楼
可以getLastError看看
|
能力值:
( LV1,RANK:0 )
|
-
-
4 楼
CreateFile的ANSI版本的函数原型是 WINBASEAPI HANDLE WINAPI CreateFileA( _In_ LPCSTR lpFileName, _In_ DWORD dwDesiredAccess, _In_ DWORD dwShareMode, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _In_ DWORD dwCreationDisposition, _In_ DWORD dwFlagsAndAttributes, _In_opt_ HANDLE hTemplateFile ); 所以,你第一个参数直接传argv[1]就行,跟打印的时候传的字符串argv[0]一样
|
|
|