I am trying to read in a text file and print out the result. The program compiles and executes fine, but nothing comes on the screen.Code:#include <iostream> #include <fstream> #include <math.h> using namespace std; int main() { char str[2000]; fstream file_op("C:\\IndusCommodities\\PriceFiles\\AllMarkets-1.txt",ios::in); if (!file_op.is_open()) { cerr << "Unable to open the file" << endl; return -1; } while(!file_op.getline(str, sizeof(str))) { cout <<str; } file_op.close(); cout <<endl; return 0; }


LinkBack URL
About LinkBacks
