#include <windows.h> #include <string> #include <winbase.h> #include <iostream> using namespace std; void main() { HANDLE h; CHAR *filename; filename =new CHAR[2500]; wcout<<"enter the file name:"; cin.getline (filename,2500); h= CreateFile( filename,FILE_SHARE_READ,0x00000001,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); cout<<filename; if (h!=INVALID_HANDLE_VALUE) { printf("File is opened"); } else { printf("Unable to open or create file"); } system ("pause"); }
Archive for March, 2011
how to Open CreateFile (Createfile example)
Posted by Karthick P.K on March 10, 2011
Posted in Programming | Tagged: CreateFile | 3 Comments »