?
Solved

FD_CLR is crashing

Posted on 2006-05-28
5
Medium Priority
?
743 Views
Last Modified: 2012-08-14
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.

0
Comment
Question by:k_kalyan
  • 2
2 Comments
 
LVL 49

Expert Comment

by:DanRollins
ID: 16782098
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
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 500 total points
ID: 16785975
Actually, it appears to be more common to use
   FD_ZERO( &rfds );
... as the first stage of intiializing the fd_set structure.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Screencast - Getting to Know the Pipeline
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question