Thanks for the interest, guys. I appreciate you all trying to help. :)
Quote:Original post by Enigma
The problem is that you are trying to pass a char to a function that expects a string. You are almost certainly misusing the function. What exactly does parser.GetIntValue do?
Yeah, I realise that is my problem, which is why I was trying to find a std::string function that performs the same task, (i.e. locating a specific character within a string).
parser.GetIntValue is part of my .ini parser - it opens a .ini file and retrieves an int value. Which int value it returns is dependent on the first two variables, which act as a key to direct the parser to the correct location within the .ini parser.
Quote:Original post by Enigma
I'm not sure if it even makes sense to iterate over the characters. Sort out the previous problem first.
That was RDragon's suggestion, not mine. ;) I'm happy to let that suggestion slide if it means I can get around this problem.
Quote:Original post by Conner McCloud
std::basic_string <char>::reference is a reference to char, not a reference to std::basic_string<char>. From there, the solution to your problem should be fairly obvious.
Hehe, not to me it isn't! :P If it were obvious, I probably would have sorted it out by now. I still find myself either wanting to convert a char into a std::string somehow, or finding a std::string function that will perform the same action.
Quote:Original post by Zahlman
I think the problem here is logical: Iteration over the characters of the string doesn't make sense here. You are effectively asking the function to parse four numbers out of each letter - how's that going to work? What exactly is the string supposed to contain in terms of these numbers, and what do you want to do with them?
Each letter is a key to a particular location within a .ini file. Each letter of the alphabet, (this is for drawing fonts from a texture), has four numbers, effectively indicating the (startx,starty) and (stopx,stopy) parameters of a rectangle. Each rectangle will hopefully then be placed onto the screen as a texture, meaning the entire string gets written onto the screen.
Quote:Original post by Zahlman
Also, please show the CINIParser::GetIntValue() function, assuming it is also your code. It appears to have a much clumsier interface than what is required.
Sure. :)
bool
CINIParser::GetIntValue(std::string _strBlock, std::string _strKey, Int32& _iValue)
{
std::string strMyKey;
strMyKey = _strBlock + "|" + _strKey;
IterStringMap iter = m_mapPairs.find(strMyKey);
if (iter != m_mapPairs.end())
{
std::string temp = ((*iter).second);
_iValue = atoi(temp.c_str());
return true;
}
return false;
}
I hope that helps. If I can convert a char to a strgin somehow, I'll be happy. And if I can get a std::string piece of code that will single out a character within a string, I'll be equally happy. Again, thanks for your help, guys. :)