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 403,010 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 2,911 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: Programming Forums

General Protection Exception Error Please Help!

Join Date: Dec 2004
Posts: 2
Reputation: C++Newbie is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
C++Newbie C++Newbie is offline Offline
Newbie Poster

Re: General Protection Exception Error Please Help!

  #5  
Dec 3rd, 2004
Originally Posted by jwenting
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();
}

Hey thanks alot for the help. That code works great. However, I need to manipulate that to work for a 2Dimensional array. If you have any idea as to how to do that please help. Thanks alot!
Reply With Quote  
All times are GMT -4. The time now is 9:37 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC