title: Weird error related to stoi?
body: <p>I am trying to convert a string into an int by using stoi, but for some reason it is giving me an error and giving me this message: </p>
  
  <p>"libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: stoi: no conversion"</p>
  
  <p>The line that deals with stoi is bolded, toward the bottom of the code.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> #include "LongDistanceCalls.h"
   #include &lt;iostream&gt;
   #include &lt;string&gt;
   #include &lt;fstream&gt;
   #include &lt;sstream&gt;
   #include &lt;algorithm&gt;
   #include &lt;iterator&gt;
  
  using namespace std;  
  
  
  string line;
  string temp = "";
  string beginning_time;
  
  void convertTimeintoInt(string beginning_time)
  {
    for(char a : beginning_time)
    {
       if(a == ':')
              continue;
      else
         temp += a;
    }
  }
  
  int main()
  {
    ifstream inFile;
    string day;
    int minutes;
    double total_callpay;
    //opens .txt file
    inFile.open("CallRecords.txt");
  
    //if .txt file is openable, printed to command line.
    if (inFile.is_open())
    {
       cout&lt;&lt;"Day Time Duration Cost"&lt;&lt;endl;
  
       while(getline(inFile,line))
       {
           istringstream split(line);//splits each string into 3 seperate strings (day, beginning_time, minutes)
  
          while(split)
               {
                 split &gt;&gt; day;
                 split &gt;&gt; beginning_time;
                 split &gt;&gt; minutes;
                 **int time = stoi(temp);**
                 time = time &gt; 0 &amp;&amp; time &lt; 2400;
  </code></pre>