Solved

Where must the text file (.txt) be placed in a C++ project when reading input for this file isntead of from the console?

Posted on 2010-11-17
4
259 Views
Last Modified: 2012-05-10
Where must the text file (.txt) be placed in a C++ project when reading input from this file instead of from the console?  I have a program and am trying to code it to read from a text file instead of have the input entered from the keyboard.  I don't know exactly where to place the file in my project.  Does it go in the folder with the header files, source files, or resource files?
0
Comment
Question by:NSing9
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
phoffric earned 125 total points
ID: 34160841
If using Visual Studio, place your text file in the folder having the project file (not solution); i.e., the folder that contains the .vcproj file.
0
 
LVL 32

Expert Comment

by:phoffric
ID: 34160851
The .vcproj advice is for case when running the program via VS. If you create the .exe file and run the .exe directly from a console, then put the text file in the same folder as the .exe file.
0
 
LVL 32

Expert Comment

by:phoffric
ID: 34160897
0
 

Author Closing Comment

by:NSing9
ID: 34161008
That actually is where the file already was.  So thank you.  It appears that my problem is something else so I will post a separate question.
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now