converting "&" in C to C# -
some c code
#include aes.h void encryption(unsigned char aes_key[16], unsigned char _buff[16], unsigned char _iv[16]){ unsigned long encrypt = 1; unsigned char output[]; aes_set_encrypt_key(aes_key, 128, &key); for(i = 0; > 16 ; ++){ aes_cbc_encrypt(&_buff[i], output, 16, &key, _iv, encrypt); } }
how '&_buff[i]' in c#? i've been trying use
_buff[i]
in c# gives different result. know how this? big help.
i think looking these search terms: c# string pass reference
that c code wrong , bad example. in general, can pass string in order change it. see example below change(buf)
. change(&buf[0])
work, it's weird. or can change(buf+3), change string beginning @ 3rd character.
void change(char *buf){ strcpy(buf, "changed"); } int main(){ char buf[50]; strcpy(buf, "0123456789"); change(buf);// result => buf = "chagned" //change(&buf[0]);//result => buf = "chagned" //change(buf + 3);//result => buf = "012changed" printf("%s\n", buf); return 0; }
and there buf[0]
single character. it's different &buf[0]
Comments
Post a Comment