Hi,
Iam using ReadDirectoryChangesW function in winAPI to know the access details of a file in a directory.the code is as follows...

        HANDLE h,hDir;
        ifstream myfile1;
        ofstream myfile2;
        char *buff="",temp[256]="";
        int i,length;
        Entry *head=NULL,*tail=NULL,*e=new Entry();
        hDir=CreateFile((LPCSTR)"C:\\sample\\example.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
        h=FindFirstChangeNotification((LPCTSTR)"C:\\sample",FALSE,FILE_NOTIFY_CHANGE_LAST_WRITE);

        BOOL b=ReadDirectoryChangesW(hDir,buff,1024,FALSE,FILE_NOTIFY_CHANGE_LAST_WRITE,NULL,NULL,NULL);
        DWORD d=GetLastError();

but i got the error 998 memory access violation.plz forgive me if any mistakes while using this function. Iam new to this fiel.Can any one help me.
Thanks in advance.

but i got the error 998 memory access violation

Than you're using some pointer which points to a restricted memory area.
Also, post the entire error, and do a debug of your program. See which pointer gets crazy...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.