d00_ape Posted June 23, 2004 Share Posted June 23, 2004 How come that this line will compile in VS 6.0 but not in VS 7.0? strOut += strData[iPos] ^ strKey[iKeyPos++]; strOut, strData and strKey are Cstring. IPos and iKeyPos is int. I got the compiler error: C2593: 'operator +=' is ambiguous Thanks Link to comment Share on other sites More sharing options...
0 +John Teacake MVC Posted June 23, 2004 MVC Share Posted June 23, 2004 Isnt it =+ ? Link to comment Share on other sites More sharing options...
0 smurfiness Posted June 23, 2004 Share Posted June 23, 2004 Ummm... need a bit more information here. Context would be helpful; contents of the strings would be even more helpful. Also, IIRC, the '^' operator is for exponential operations, which don't apply to strings. Link to comment Share on other sites More sharing options...
0 kjordan2001 Posted June 23, 2004 Share Posted June 23, 2004 (edited) Ummm... need a bit more information here. Context would be helpful; contents of the strings would be even more helpful. Also, IIRC, the '^' operator is for exponential operations, which don't apply to strings. I didn't think you could do powers that way. I thought you had to do pow(base,exp) which is in cmath. I'm not sure what the ^ operator does to strings either. Possibly you mean +? Isnt it =+ ? And no, it is +=. Edited June 23, 2004 by kjordan2001 Link to comment Share on other sites More sharing options...
0 John Veteran Posted June 23, 2004 Veteran Share Posted June 23, 2004 I know ^ isn't an exponent operator, because I keep trying it and I get the same results every time :pinch: Can you treat strings as arrays in .NET? :unsure: I've never tried :s Link to comment Share on other sites More sharing options...
0 smurfiness Posted June 24, 2004 Share Posted June 24, 2004 Well, this isn't .NET code. He's trying to compile in VS6 and VS7, which suggests that it's native code (also he said they're CStrings). And yes you can. The .NET String class has an indexer which you can use to get individual characters. Link to comment Share on other sites More sharing options...
0 MG-Cloud Posted June 25, 2004 Share Posted June 25, 2004 MSDN is your friend! ^^ Does explicitly casting any of the strData[]'s to (char) work? Link to comment Share on other sites More sharing options...
0 bwx Posted June 25, 2004 Share Posted June 25, 2004 Since strData is a CString, strData[somePosition] would equate to a char or wchar_t, depending on if you're using UNICODE or not. So according to your code, the two char values should be XOR'ed, and appended to strOut. I can't really see any error in your code, other than maybe the operator += call is conflicting with the others. try this: strOut += (TCHAR)(strData[iPos] ^ strKey[iKeyPos++]); hope that helps, bwx Link to comment Share on other sites More sharing options...
Question
d00_ape
How come that this line will compile in VS 6.0 but not in VS 7.0?
strOut += strData[iPos] ^ strKey[iKeyPos++];
strOut, strData and strKey are Cstring.
IPos and iKeyPos is int.
I got the compiler error: C2593: 'operator +=' is ambiguous
Thanks
Link to comment
Share on other sites
7 answers to this question
Recommended Posts