title: Extract double from a string in c
body: <p>I want to write a function in C that has one string parameter and returns a double number.
  For example when the string is <code>fsldnf213414fasfa</code> it should return <code>213414</code>.
  But it should be also able to return floating points like <code>fasfasf123.412412fasfff</code> as <code>123.412412</code>.</p>
  
  <p>I've already a function that can extract only integer numbers not floating points:</p>
  
  <pre><code>double get_num(const char* s) 
  {
      unsigned int limit = UINT_MAX / 10;
      double value = 0;
      if ( !s ) {
          return 0;
      }
      for ( ; *s; ++s ) {
          if ( value &lt; limit ) {
              if ( isdigit(*s) ) {
                  value *= 10;
                  value += (*s - '0');
              }
          }
          else {
              return UINT_MAX;
          }
      }
      return value;
  }
  </code></pre>