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
255 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 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

12 Experts available now in Live!

Get 1:1 Help Now