2 Replies - 499 Views - Last Post: 01 May 2010 - 12:20 AM Rate Topic: -----

#1 solodolo   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 50
  • Joined: 31-December 09

Reading In File and Data

Posted 29 April 2010 - 03:17 PM

I am learning C++ and just coming from a Java background. I know there are many methods to reading in a file in Java. I know that there is a method to read in a line, read the next string separated by a space delimiter and if you are expecting a int, there is a method for that.

Now how I would go about doing this in C++? I have looked at the ifstream class to open a file but what else would I need to achieve what I had said above?

ALSO, I am using Visual C++ and was having trouble opening my text file. I know how to set the properties to change the arguments but when I try to open the file using ifstream, it doesn't open. Where should I be storing this text file using the Visual C++ IDE?

Please help me out. Thank you.

Is This A Good Question/Topic? 0
  • +

Replies To: Reading In File and Data

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Reading In File and Data

Posted 29 April 2010 - 03:24 PM

Here's a tutorial to get started.
Was This Post Helpful? 0
  • +
  • -

#3 Crunch   User is offline

  • D.I.C Lover
  • member icon

Reputation: 139
  • View blog
  • Posts: 1,222
  • Joined: 28-July 09

Re: Reading In File and Data

Posted 01 May 2010 - 12:20 AM

View Postsolodolo, on 29 April 2010 - 09:17 PM, said:

ALSO, I am using Visual C++ and was having trouble opening my text file. I know how to set the properties to change the arguments but when I try to open the file using ifstream, it doesn't open. Where should I be storing this text file using the Visual C++ IDE?

Please help me out. Thank you.


Place your text file in the folder where the compiler create's the executable file.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1