topical media & game development

talk show tell print

professional-program-25-FileRead-FileRead.c

? / professional-program-25-FileRead-FileRead.c


  
FileRead.cpp

  
  
  include <iostream>
  include <fstream>
  include <string>
  
  using namespace std;
  
  int main()
  {
    ifstream inFile(<FileRead.cpp>);
  
    if (inFile.fail()) {
      cerr << "Unable to open file for reading." << endl;
      exit(1);
    }
  
    string nextToken;
    while (inFile >> nextToken) {
      cout << "Token: " << nextToken << endl;
    }
  
    inFile.close();
  
    return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.