?
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
Medium Priority
?
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 32

Accepted Solution

by:
phoffric earned 500 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

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.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Suggested Courses

800 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