title: Extracting filedescriptors from fd_set
body: <p>I have to implement a conversion tool between two different protocols.
  It should be a relatively simply loop, triggered by filedescriptor events.
  The protocol APIs however:</p>
  <ol>
  <li>st API: Is meant for use with <strong>select()</strong>, it expose a GetFD() method that will throw it fd's into the given fd_set using FD_SET</li>
  <li>nd API: Only works with <strong>poll()</strong>  (it is ZMQ)</li>
  </ol>
  <p>Is there any way to extract the fds from a fd_set, without calling select()? (Preferably portable)</p>
  <p>I have tried looking into the source of the fd_set structure, but it is not really readable and probably a hint that you should not touch it through anything than the 4 macro, FD_CLR/SET/ISSET/ZERO.</p>
  <pre><code>//Pseudo-code of what i hope to achieve
  // Get fd's from API1
  fd_set readfds;
  FD_ZERO( &amp; readfds );
  int max = api1.GetFd(readfds);
      
  struct zmq_pollitem_t poll_items[MAX_COUNT];
  int fd_count = 0;
  convert_fdset_to_pollitem( readfds , poll_items , fd_count ); //what i need
  
  poll_items[fd_count].fd = api2.GetFD();
  poll_items[fd_count].socket = api2.GetSocket();
  fd_count++;    
  
  const uint32_t timeout_msec = 500;
  int ret = zmq_poll( poll_items , fd_count , timeout_msec);
  </code></pre>