cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
File Creation Location Trouble
File Creation Location Trouble
Aug 16, 2010 at 1:51pm UTC
D Technodude
(51)
I made a file and tried to change it but the program made another file instead. I was wondering how to specify the file path, or even if there is a way.
Aug 16, 2010 at 2:41pm UTC
mcleano
(922)
Can you post the code you used?
Aug 16, 2010 at 2:50pm UTC
D Technodude
(51)
It's not a problem I just don't know how to specify a file path for where the file I want it to read is.
Aug 16, 2010 at 6:15pm UTC
mcleano
(922)
You use it when you create an i/o/fstream object.
http://www.cplusplus.com/reference/iostream/fstream/fstream/
http://www.cplusplus.com/reference/iostream/fstream/open/
If you show me your code I can more specifically show you where to put the file path.
Last edited on
Aug 16, 2010 at 6:15pm UTC
Aug 16, 2010 at 6:18pm UTC
D Technodude
(51)
How do you specify a file path like:
c:\user\owner\desktop\projects\test.txt
Aug 16, 2010 at 7:21pm UTC
AdventWolf
(102)
In your program when you state the name of the file that you want to save, just add the directory:
1
2
3
fstream file; file.open(
"C:/user/owner/desktop/projects/text.txt"
, ios::out);
//save information
Aug 16, 2010 at 8:42pm UTC
D Technodude
(51)
THANK YOU SO MUCH!!!!!!!!!!!!!!
Topic archived. No new replies allowed.