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

  • Home
  • SEARCH
  • 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 8162775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:50:34+00:00 2026-06-06T18:50:34+00:00

I have next code: int main() { OwnSelect(23, FD_READ | FD_WRITE); // <—- Several

  • 0

I have next code:

int main()
{
 OwnSelect(23, FD_READ | FD_WRITE); // <---- Several arguments as one
 return 0;
}

int OwnSelect(SOCKET s, long lNetworkEvents)
{
 // How can i check that FD_READ has been passed?
 if(lNetworkEvents == FD_READ)
 {
  // never here
 }
 return 0;
}

How can i check that FD_READ has been passed no matter if another FD has been passed with FD_READ.
Thanks!

  • 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-06-06T18:50:35+00:00Added an answer on June 6, 2026 at 6:50 pm

    Seems like you’re missing out on a bit of basic bit manipulation here. You’re OR’ing FD_READ and FD_WRITE (| = bitwise OR), thereby setting the bits indicated by both values, as a parameter. To check if FD_READ was passed, you need to AND lNetworkEvents with FD_READ and check if the result equals FD_READ, like so:


    if (FD_READ == (lNetworkEvents & FD_READ)) { ... }

    This of course assuming that FD_READ and FD_WRITE are values that were meant to be used this way (i.e. typically don’t have overlapping bits).

    edit: fixed, wabepper is absolutely right 🙂 oops!

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

Sidebar

Related Questions

I have the following code struct Node { int accnumber; float balance; Node *next;
In the next code: #include <stdio.h> int main(void) { int c; while ((c=getchar())!= EOF)
So I have code like int main(int argc, char* argv[]) { string outputUrl ;
I have this code: #include <stdio.h> int getAns(void); int num; int main() { int
I have next code, <form id=form1 runat=server> <asp:Label runat=server ID=Label1 EnableViewState=false /> <asp:CheckBox runat=server
I have next code require 'rack/rpc' class Server < Rack::RPC::Server def hello_world Hello, world!
I have the next code: class Printer{ Activity activity; public Printer (Activity activity) {
I have the next code : public class AddPrinter extends ListActivity { @Override public
I have the next code in javascript. I deleted some unnecessary items because it
I have the next code: Process p = Runtime.getRuntime().exec(args); and I want my program

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.