G
Guest
I am trying to use a C style string in a managed class. When I try to call a function like strcmp I get an error. For example, this code
__gc MyClass
char str _nogc [16]
void foo()
strcpy(str, "Hello")
Would give the error
error C2664: 'strcpy' : cannot convert parameter 2 from 'char [16]' to 'const char *
Cannot convert a managed type to an unmanaged typ
I would use System::String, but I am porting some old code and I'd rather not rewrite every single string processing bit of it
Anyone know of a way to use C style string functions in a managed class?
__gc MyClass
char str _nogc [16]
void foo()
strcpy(str, "Hello")
Would give the error
error C2664: 'strcpy' : cannot convert parameter 2 from 'char [16]' to 'const char *
Cannot convert a managed type to an unmanaged typ
I would use System::String, but I am porting some old code and I'd rather not rewrite every single string processing bit of it
Anyone know of a way to use C style string functions in a managed class?