How can I find the type of the value present in vector of type string?
<p>I have a config file: </p>

<pre><code>#X,Name,hostid,processid,executecommand,Max Runs, Max failure time 
X,Main_XYZ_service,1,1,/opt/bada/bin,3,6,300
</code></pre>

<p>I parsed the above config file and stored each of the values in a vector of type string.</p>

<p>This is stored in <code>vector&lt;string&gt; scanned</code>:</p>

<pre><code>//scanned[0]=X
//scanned[1]=Main_XYZ_service.........
 long H_hostid = atoi(scanned[5].c_str()); 
</code></pre>

<p>how can I detect the type of the elements present in the vector?</p>

<p>If I call <code>atoi()</code> with a string that doesn't have a number, <code>atoi()</code> returns <code>0</code>, but it also returns <code>0</code> if the string contains the number <code>0</code>.  How can I correctly assign a value to <code>H_hostid</code>?</p>
