hi there! im trying to do a xor beetwin two cha but i coudl no there is my code:

String^ val2;
String^ val3;
String^ val1;
String^ val;
 char  *chval1;
char  *chval2;
 char  *chval3;
char *chval;
char *chv; 
val1=GZMK1->Text;//GZMK1 is textbox
val2=GZMK2->Text;//GZMK2 is textbox
val3=GZMK3->Text;//GZMK3 is textbox
chval1 = static_cast<char *>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(val1).ToPointer());
//convert String^ to a char 
	chval2 = static_cast<char *>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(val2).ToPointer());
	chval3 = static_cast<char *>(System::Runtime::InteropServices::Marshal::StringToHGlobalAnsi(val3).ToPointer());
for( int i=0;i<sizeof(chval1);i++)
String ^ str =gcnew String(chv);
GZMK->Text=str;//GZMK is a textbox where i m gonna put my result

leas any body could help me i m gonnaa be a grathful

7 Years
Discussion Span
Last Post by Ancient Dragon

line 19: What exactly do you expect sizeof() to return on that line? Answer: sizeof() is returning the size of a pointer, not the length of the string to which it points. In otherwises use of the sizeof operator on that line is meaningless.


ok i see but i stil hav a problem but i don't know what to do cause when i xcute it it's made me an exception whicch i never seen before there is't :

Une exception non gérée du type 'System.NullReferenceException' s'est produite dans interfaceZMK.exe

Informations supplémentaires : La référence d'objet n'est pas définie à une instance d'un objet.


Dear Ancient Dragon i initianiizd but it still giving me the same exception im blocked

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.