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?

Recommended Answers

All 3 Replies

You should delete the line because it makes no sense?
What are you trying to do anyway?

i want to take a product number that is ten characters long (it includes both numbers and letters) and seperate it because each character means something different.

cout << setw(40) << "ENTER IN PRODUCT NUMBER: " << endl;
	cin >> productNumber;

	string str= "productNumber";
                           
	string str1, str2, str3, str4, str5, str6, str7, str8;
	size_t pos;

	str1 = str.substr (1,1);
	str2 = str.substr (2,3);
	str3 = str.substr (4,5);
	str4 = str.substr (6,6);
	str5 = str.substr (7,7);
	str6 = str.substr (8,8);
	str7 = str.substr (9,9);
	str8 = str.substr (10,10);


	type = str1
	{
		if (type == 'F' || type == 'm')
		{
			one = "Nominally";
			four = "nominal";
		}

		else if (type == 'M' || type == 'm')
		{
			one = "Absolutly";
			four = "absolute";
		}
	}

this is what i have so far...

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.