0

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?

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by j-green.10
0

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.

0
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...

Edited by j-green.10: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.