HANDLE WINAPI CreateFile( __in LPCTSTR lpFileName, __in DWORD dwDesiredAccess, __in DWORD dwShareMode, __in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes, __in DWORD dwCreationDisposition, __in DWORD dwFlagsAndAttributes, __in_opt HANDLE hTemplateFile );
#include <stdio.h> #include <windows.h> #include <tchar.h> #define MAX_LINE 1024 int main(int argc, char **argv) { HANDLE fp; DWORD readn; BOOL brtv; char buf[MAX_LINE]; if (argc != 2) { printf("Usage : %s [file]\n", argv[0]); return 1; } fp = CreateFile( argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (fp == INVALID_HANDLE_VALUE) { printf("File 1 Open Error (%d) : %s\n", GetLastError(), argv[1]); return 1; } while(1) { memset((void *)buf, 0x00, MAX_LINE); brtv = ReadFile(fp,buf, MAX_LINE-1, &readn, NULL); if(brtv && readn == 0) { break; } printf("%s", buf); } return 1; }
Copyrights © - Joinc, All Rights Reserved. Inherited From - Yundream Rebranded By - Joonphil
CreateFile
사용 법
매개 변수
반환 값
상세 내용
예제
Recent Posts
Archive Posts
Tags