In my code i have written:

std::ifstream stm;
	stm.str("str100");
	double d;
	stm >> d;

and an error comes up saying that:

'str' : is not a member of 'std::basic_ifstream<_Elem,_Traits>'
       with
       [
        _Elem=char,
        _Traits=std::char_traits<char>
    ]

What should i do?

std::ifstream stm;
	stm.open("str100");
	double d;
	stm >> d;

If you have a file called "str100" with a double in it, this is how you could read that double into the variable d. You had it fine except for the second line. I'm not sure what you were trying to do with "str", but as the error says, "str" isn't part of ifstream:

http://www.cplusplus.com/reference/iostream/ifstream/

However, "open" is:

http://www.cplusplus.com/reference/iostream/ifstream/open/

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.