fstream in non-current directory

P

Peng Yu

Could you give some examples about how to write a file in a non local
directory?
And what if the directory is not exist, do I have to create one?

Thanks,
Peng
 
V

Victor Bazarov

Peng said:
Could you give some examples about how to write a file in a non local
directory?

There is no concept of "directory" in C++. Whatever form you need to
give the file name to reach the "non-local directory" should work just
fine.
And what if the directory is not exist, do I have to create one?

That's OS-specific. For all C++ cares, opening a file that specifies
a name with a "directory" that "doesn't exist" might initiate some kind
of "creation of the directory" operation.

Try posting to a newsgroup that deals with your OS.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,184
Messages
2,570,973
Members
47,530
Latest member
jameswilliam1

Latest Threads

Top