C++ I/O don't understand why there is -1
<p>I am simply trying to read each character from a file and print them in the screen.
For testing, I tried to print ascii value in a console screen first before printing characters.</p>

<p>the content of the file I am trying to read is below:</p>

<pre><code>assign1_2.cpp:33:20: error: cannot convert 'std::string 
    {aka std::basic_string&lt;char&gt;}' to 'const char*' for argument '1' 
    to 'int atoi(const char*)'
</code></pre>

<p>I used the code below</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
#include &lt;vector&gt;
#include &lt;stdlib.h&gt;
using namespace std;

void CountLetters(string filename);

int main()
{
        CountLetters("count.txt");
}

void CountLetters(string filename)
{
    cout &lt;&lt; filename &lt;&lt; endl;

    ifstream in;
    in.open(filename.c_str(), ios::in);
    vector&lt;char&gt; letter;
    char temp;
    while (!in.eof())
    {
        cout &lt;&lt; in.get() &lt;&lt; endl;
    }

    in.close();

}
</code></pre>

<p>After running these code and I see  "-1" at the end in the console screen.
Anyone please explain? thanks</p>
