MSSQLWIKI

Karthick P.K on SQL Server

how to Open CreateFile (Createfile example)

Posted by Karthick P.K on March 10, 2011

#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");

}
About these ads

One Response to “how to Open CreateFile (Createfile example)”

  1. […] how to Open CreateFile (Createfile example) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 2,137 other followers

%d bloggers like this: