0
votes
ostream &stream;
stream.write(SomeUnsignedCharStar, intSize);

error C2664 cannot convert parameter 1 from const unsigned char * to const char *

Is there an overload write for const unsigned char *? I do not want to change SomeUnsignedCharStar because it is everywhere in the legacy code I inherited. This was compiled on VC6 with no complain. I am slowly upgrading the code to VS2003 and then VS2010 evantually.

What is the easiest and cleanest fix?

1
I wouldn't bother upgrading to VC++ 2003 first, just go straight to the latest. Visual Studio .NET 2003 was possibly the buggiest version ever.Ben Voigt
I did go straight to VS2010 and all hell broke loose. There are just too many things to take care of in the conversion from VC6 to VS2010. I tried conversion to VS2008 first and all work out pretty good. All projects built in VS2008. Conversion from VS2008 to VS2010 is much easier being a smaller step. It is not without issue though.dysonfree
Ok, that sounds reasonable. I'm just advising against messing with VC++ 2003.Ben Voigt

1 Answers

0
votes

You can cast this without any issues. Strict aliasing allows casting pointers between unsigned and signed versions of the same type, as well as casting from any type to const char*, so you're safe here.