Program runs hot dont show any data

Hi guys: Can any one please tell me why its not displaying data from the text file. Program runs but it dont show any thing. Thanks.


#include<iostream>
#include<fstream>
#include<cstdlib>

using namespace test;

int main()
{
    string capital = "";
    ifstream inFile;
    inFile.open("febsales.txt", ios::in);
    if (inFile.is_open())
       {
        while (inFile.eof())
          {
          getline(inFile, capital);
          cout << capital << endl;
          }
        }
    else
        {
          cout << "File could not be opened." << endl;
        }
    inFile.close();
    system("pause");
    return 0;
}
mustish1Asked:
Who is Participating?
 
PryratesConnect With a Mentor Commented:
a wild guess:
try
  while (!inFile.eof())

Open in new window

or
  while (inFile.eof() == false)

Open in new window

or something like that.

I am not familiar with c++.net, but this might work.
0
 
mustish1Author Commented:
Yahooooooooooooooo
Thanks a lot.
0
 
PryratesCommented:
you are welcome :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.