title: C - timeout on a function that reaturn string
body: <p>I have a C code that send a request to a card, then store a response from the card and print it.
  To store the return command I use :</p>
  
  <pre><code>char * returnCommand = Cmd_Debug_GetResponse();
  </code></pre>
  
  <p>No problem there.
  My problem is when I want to set a timeout on this response. If the function "Cmd_Debug_GetResponse()" does not return anything in 5 seconds, I want the program to keep going to the next lines.</p>
  
  <p>I try to use <strong>select()</strong> in this way, but with no good results :
  (I wrote only the interesting part)</p>
  
  <pre><code>fd_set input_set;
  struct timeval timeout;
  int ready_for_reading = 0;
  FD_ZERO(&amp;input_set);
  FD_SET(0, &amp;input_set);
  
  timeout.tv_sec = 5;
  timeout.tv_usec = 0;
  ready_for_reading = select(1, &amp;input_set, NULL, NULL, &amp;timeout);
  if(ready_for_reading)
  {
      char * returnCommand = Cmd_Debug_GetResponse();
      printf("OK : %s\n", returnCommand);
  } else {
      printf("5 secs are over\n");
  }
  </code></pre>
  
  <p>The code always loop on the timeout...
  Can someone tell me what is wrong, and what to do ?</p>
  
  <p>Thanks</p>