ifstream string constructor 
Author Message
 ifstream string constructor

Hi,
why is it that I can't do:
string name = "file";
ifstream infile(name);

I know the standard says it can't be done, but why?

--

Daniel Lidstr?m

62 23' 25" N
17 15' 31" E



Mon, 11 Apr 2005 20:15:42 GMT  
 ifstream string constructor
    If you are asking why there is no conversion operator from std::string
to const char* -- well, there's a lot of good reasons.
    If you are asking why there is no constructor for ifstream which takes a
std::string --- pretty much just an oversight.

--
Truth,
James Curran
www.NovelTheory.com  (Personal)
www.NJTheater.com   (Professional)
www.aurora-inc.com   (Day job)


Quote:
> Hi,
> why is it that I can't do:
> string name = "file";
> ifstream infile(name);

> I know the standard says it can't be done, but why?

> --

> Daniel Lidstr?m

> 62 23' 25" N
> 17 15' 31" E



Mon, 11 Apr 2005 20:28:15 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. BoundsChecker error in ifstream/ofstream constructor

2. ifstream/string confusion [somewhat long]

3. ifstream/string confusion [somewhat long]

4. ifstream doesn't want to get the whole string

5. Bug with Bitmap(string) constructor?

6. Possible bug with Bitmap(string) constructor?

7. DataRelation Constructor (String, DataColumn[], DataColumn[])

8. Get the COM+ Constructor String and split it

9. Problems with strings in constructors

10. string constructor with /MDd

11. Wrong constructor used for vector<string>.

12. string's constructor

 

 
Powered by phpBB® Forum Software