When program is running, file is not read : <p>Can someone help me with understanding why this code isn't working, when program is running, "booklist.txt" can't be loaded. </p>

<p>When I call function listbooks while the program is running, it doesn't 
display anything on the screen, so that's the main problem. (file is not empty.)</p>

<pre><code>  #include &lt;iostream&gt;
    #include &lt;cstdlib&gt;
    #include &lt;fstream&gt;

    using namespace std;
    void listbooks()
    {
        ifstream TheFile("booklist.txt");

        char autor;
        char bookname;
        long int isbn;

        while (TheFile &gt;&gt; autor &gt;&gt; bookname &gt;&gt; isbn)
    {
            cout &lt;&lt; autor &lt;&lt; " " &lt;&lt; bookname &lt;&lt; " " &lt;&lt; isbn &lt;&lt; endl;
    }
    }

    int main()
    {
        int choice;
    do {
            cout &lt;&lt; "1.List all books" &lt;&lt; endl;
            cout &lt;&lt; "2.Borrow book" &lt;&lt; endl;
            cout &lt;&lt; "3. Exit" &lt;&lt; endl;
            cout &lt;&lt; "Enter your choice: ";
            cin &gt;&gt; choice;
            switch (choice)
    {
            case 1:
                listbooks; 
                break;
            case 2:
                break;
            default:
                cout &lt;&lt; "";
    }
    } while (choice != 3);
        system("pause");
        return 0;
    }
</code></pre>
