reading data from a file

Im having trouble outputting the text from my text file into the debugging stage in my program

here is my codes so far

/* Purchase Project
created by C. Shumate
November 5, 2012 */

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;

int main()
{
ifstream inputFile;



cout << "Computer Store" << endl;
cout << "Created by Cedric Shumate" << endl;



cout <<"Item Item Purchase" << endl;
cout <<"Number Description Quantity Price Amount"<< endl;

inputFile.open("Purchase.txt");


cout << "Item count: " << endl;
cout <<"Purchase total" << endl;

inputFile.close();
system("pause");
return 0;

}
here's the clue:

1. we saw you're using this:
 
#include <string> 

but you're not use string

2. we did't see your effort to outputting the file's contain

hope helps :)
ok i took the #include <string> out
now what?
actually, i said that you're not using string because you should use them. that's why i call it a clue
oh! ok i get it now, but the main thing i want to do is get the text from my file onto my solution when i debug my code
thats where im having trouble, ive read my book but its not giving much insight
onto my solution

what do you mean by solution? is it a file type or what?

if you want to get a text from your .txt file, you can do this:

1
2
3
4
5
6
7
8
9
10
11
#include <fstream>
#include <string>
//...
fstream some_file ("D:\\some file.txt");
string some_string = "";

while (!some_file.eof()) {
     getline (some_file, some_string);
     //you'll know what to do...
}
some_file.close();
Topic archived. No new replies allowed.