User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,736 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,230 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:

General Protection Exception Error Please Help!

Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation: jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough jwenting is a jewel in the rough 
Rep Power: 18
Solved Threads: 191
Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: General Protection Exception Error Please Help!

  #4  
Dec 3rd, 2004
you should anyway use ifstream instead of fstream for reading...

Omitting all errorchecking, the following will read and echo lines from a textfile:
#include <fstream>
#include <string>
#include <iostream>
#include <iomanip>

int main()
{
  ifstream fs;
  fs.open("test.txt");
  string s;
  while (fs >> s)  cout << s << endl;
  fs.close();
}
Reply With Quote  
All times are GMT -4. The time now is 3:51 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC