• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

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;
}
0
mustish1
Asked:
mustish1
  • 2
1 Solution
 
PryratesCommented:
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now