Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4273944
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:46:51+00:00 2026-05-21T07:46:51+00:00

h=CreateFile(c:\\test.txt,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_READONLY|FILE_FLAG_OVERLAPPED,NULL); OVERLAPPED ol2; memset(&ol2,0,sizeof(OVERLAPPED)); ol2.hEvent=CreateEvent(NULL,false,false,NULL); if(!ReadFile(h,iobuffer+pointsize,value,NULL,&ol2)) printf(Last Error %u,GetLastError()); if(WaitForSingleObject(&ol2.hEvent,INFINITE)!=0){ printf(Last Error %u \n,GetLastError());

  • 0
h=CreateFile("c:\\test.txt",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_READONLY|FILE_FLAG_OVERLAPPED,NULL);

    OVERLAPPED ol2;
    memset(&ol2,0,sizeof(OVERLAPPED));
    ol2.hEvent=CreateEvent(NULL,false,false,NULL);
    if(!ReadFile(h,iobuffer+pointsize,value,NULL,&ol2))
    printf("Last Error %u",GetLastError());
    if(WaitForSingleObject(&ol2.hEvent,INFINITE)!=0){
        printf("Last Error %u \n",GetLastError());

    }

WaitForsingleobject returns invalid handle, yet I do not see why…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T07:46:52+00:00Added an answer on May 21, 2026 at 7:46 am

    I think it should be written:

    if(WaitForSingleObject(ol2.hEvent,INFINITE)!=0){
                printf("Last Error %u \n",GetLastError());
    

    Note the removed & before ol2.hEvent

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We had a line of code if( !CreateFile( m_hFile, szFile, GENERIC_READ|GENERIC_WRITE, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL
I created a file named 'test.txt' and then took input from the user to
When CreateFile Function is called without the flag FILE_FLAG_NO_BUFFERING, what is the size of
I have a table [Product] with a column [CreateTime] datetime null, and is has
I wrote unit test (JUnit 4) that performs some logic and writes result to
I'm running some test to prove a concept and i just wrote this code
I am trying this to test wether an XML documents gets created or not
Problem Description I am writing application for Android and use native code, And test
I've build a simple test which creates and deletes a file (name does not
I'm developing a network-redirector like SMB. I want to test various file I/O to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.