including a text file

how to include a text.txt file from your computer

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 1703 Views - Last Post: 28 August 2009 - 12:42 AM Rate Topic: -----

#16 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,422
  • Joined: 15-July 09

Re: including a text file

Posted 28 August 2009 - 12:32 AM

ok try this
fstream out;
out.open("hello.txt",ios::in);

and make sure that the file is in the same folder as the .cpp
Was This Post Helpful? 0
  • +
  • -

#17 poncho4all  Icon User is offline

  • D.I.C Head!
  • member icon

Reputation: 123
  • View blog
  • Posts: 1,422
  • Joined: 15-July 09

Re: including a text file

Posted 28 August 2009 - 12:42 AM

By the way remember to change all the conditions
if(InFile.is_open())
while(!InFile.eof()) 
while(getline(out,line))
getline (InFile, lineBuffer);


InFile is no longer in the game.
Another thing the destiny should be a char not InFile im guessing you where looking for ch, thats if im reading right cuz is kind of difficult to read like that, but if im wrong what is ch doing?, how is it going throw the text?, are you sure that it is changing? check that

Hope it helps
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2