We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Program runs hot dont show any data

mustish1
mustish1 asked
on
Medium Priority
427 Views
Last Modified: 2013-12-14
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;
}
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Yahooooooooooooooo
Thanks a lot.

Commented:
you are welcome :)
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.