Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
284 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses

604 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