On Apr 27, 1:28 pm, Assertor <gidae...@gmail.comwrote:
Is there any way to create an instance of std::ifstream using
std::string.
(through std::ifstream's constructor or assignment operator or
iterator, etc...)
i.e.
std::string str = "this is a string";
std::ifstream ifs = str; //<----- this is a just pseudo code.
(^^;; I can solve this using making temporty file and write the str on
the file and reading it using std::ifstream...
but I don't want to make a additional file io ^^)
Why do you want to do this? Normally, except for creation, you
should be using the istream interface (from the base class).
And of course, this works just as well with an istringstream as
with an ifstream.
--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34