2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by VernonDozier
1

hello
i am trying to make a program that gets numbers from a file and do stuff with it. My question is: Is that file just a file that holds another program that reads out numbers?
Like a dummy I just put these numbers in a file and then tried to read them into my program.
Am I right that it is actually another program. And what does it mean that the said file has to be in the same folder??
Mikelle

You probably want a text file that holds the numbers. You'll have a C++ program that opens this text file using an ifstream. You'll then read the data from this text file into variables that you have defined in your C++ program, then you'll do whatever you want to do with those variables which now hold the text file data.

Regarding where that text file is placed, if it is in the same folder on your computer as your executable program is in, then when you open that file from your C++ program, you'll only need to specify the filename. You won't need to specify a path because the default path is the path that the executable program resides in.

[EDIT]
posted this before I saw that you'd figured it out.
[/EDIT]

Votes + Comments
Although your efforts were in vain, you still were trying to help. Sorry for not giving you a +rep with all the help you've given me.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.