I need some help with Binary I/O. I know how to do it when I am specifying the filename in the code
ie: fstream fio("persons.txt", ios::in | ios::out | ios::binary | ios::trunc);
What I need to know is how to open or create a file with a file name that will vary and wont be persons. txt everytime. Basically, a file name specified by the user. How would I do that? I can't seem to find anything online for it. Also, please dumb it down for me, I'm still kind of new to this.
skitzo315
0
Newbie Poster
Recommended Answers
Jump to PostReplace "persons.txt" with a string variable containing the filename you have gotten from the user. I hope you know how to get user input...
By the way, code tags should look like this:
[code=c++] ...your code... [/code]
The fact that you tried is appreciated, however :P
All 3 Replies
death_oclock
103
Posting Whiz
daviddoria
334
Posting Virtuoso
Featured Poster
siddhant3s
1,429
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.