I can't get this function to compile. All it does is converts all characters one by one to upper case characters. When I try to assign these upper case character to a new string (not allowed to use arrays) I have problems. I'm using VC++ 6.0 standard. A friend used DJGPP and had no problems.

I keep getting one error message on the last line where replace
is called:

error C2664: 'class std::basic_string

I'm guessing it has to do with assigning a character to a string variable but I haven't seen anything (in text books) that says you're not allowed to do that.

Am I using this function incorrectly or is there a problem with the function in the string class?

Heres the code:
------------------------------------------------------------------------------------
// Accept mixed-case characters of input string and return string containing all upper-case characters

string allcaps (string inputStr)
{
// Scroll through each character in the string
for (int charpos = 0; charpos < inputStr.length(); charpos++)
{
// Assign current character to temp char variable
char selectedChar = inputStr.at(charpos);

// Re-Assign upper-case equivalent of selectedChar to itself
selectedChar = toupper(selectedChar);
inputStr.replace(charpos, 1, selectedChar);
}

return inputStr;
}

Thanks in advance!