Reading from text files in C/C++
If you're interested in learning OOP and don't have the ambition to work with embedded electronics (roughly everything smaller than a phone), you're really more interested in C++ than C. This review is written based on the assumption you want to write C++ and ignores C.

Your current method of reading a file is odd. While checking for EOF is a relatively easy method to check whether you've hit the end of a file yet, it's not the only thing you should check for when reading a file. C++ can check whether the input is still 'good'. You could do so like this:

#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;vector&gt;

void readFile()
{
    std::ifstream input("file.txt", std::ios::in);
    std::string currentLine;
    std::vector&lt;std::string&gt; allLines;
    std::vector&lt;std::string&gt;::iterator itLines;
    while (input.good())
    {
        getline(input, currentLine);
        allLines.push_back(currentLine);
    }
    for (itLines = allLines.begin(); itLines != allLines.end(); itLines++)
    {
        // Iterate over the data you just read
    }

}


Note that since we don't return anything, a void will do.

Now you're reading all lines of data (up till every newline) and iterate over them, which appears to be what you want to do. Not only will this stop when the file has reached EOF, it will also check whether the stream hasn't failed or took a bad chunk somewhere along the way.