0

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.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Lucaci Andrew
0

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...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.