title: Convert string to integer ( binary equivalent )
body: <p>I have seen lots of ways to convert a string such as "12345" into an integer based on what the charecters represent ( the integer 12345 ) , but I need to be able to take a string's binary equivalent and turn <em>that</em> into an integer. For example , take the string "Hello!" . On the hard drive ( or memory ) it is stored as a binary pattern :</p>
  
  <p>010010000110010101101100011011000110111100100001</p>
  
  <p>If you treat these bits as a binary number instead of text, then that pattern is also equal to 79600447942433.</p>
  
  <p>"Hello!" = 79600447942433</p>
  
  <p>The only way I now of is to loop until the end of a string and convert individual charecters into integers, then multiply by 2^ position_of_charecter</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;cmath&gt;
  using namespace std ;
  // ...
  string str = "Hello!" ; int i , total , temp ; unsigned char letter ;
  for ( i = 0 ; i &lt; str.length() ; i++ )
  {
      letter = string[ i ] ;
      temp = ( int ) letter ;
      total += ( temp * pow( 2 , i ) ) ;
  }
  cout &lt;&lt; "\"Hello!\" is equal to " &lt;&lt; total &lt;&lt; endl ;
  </code></pre>
  
  <p>But I am working with very large strings and would like a faster way to convert it</p>