Link to home
Start Free TrialLog in
Avatar of k_kalyan
k_kalyan

asked on

FD_CLR is crashing

In the following piece of code FD_CLR is crashing ?

Compiler : VC++ 6
OS          : Win XP

The same piece of code is working in Linux.

Could u pls help me in resolving this.

=====================================
                  fd_set rfds;
                FD_CLR(0,&rfds); // Crashed, Reason : Unhandled Exception, Illegal Istruction.
            FD_SET(0, &rfds);      
            retVal = select(0, NULL, NULL, NULL, &tv);
            if (-1 == retVal)
            {
                             // Action
            }
=====================================
Thanks for ur valuable time in helping me in this.

Avatar of DanRollins
DanRollins
Flag of United States of America image

At first guess, it would because you have not pre-set the members of fd_set.  I believe normal usage, is for instance:

fd_set rfds;
rfds.fd_count= 6;
FD_CLR( 0, &rfds ); // should avoid the crash
ASKER CERTIFIED SOLUTION
Avatar of DanRollins
DanRollins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial