string - How to set value of unsigned char array on C -


i have unsigned char array of size 64 want change value of @ runtime, attemps have failed miserably, doing wrong?

int main() {   unsigned char buffer[64]={0xef,0xaa,0x03,0x05,0x05,0x06,0x07,0x08,......};   buffer = {0x01,0x04,0xa0,0xb0,0xde,0x00,.....}; //fails    return 0; } 

edit: don't want fill zero's array buffer, want place new value

another solution use of almighty memcpy() , c99 compound literals:

memcpy(array, (int []){ 0x00, 0x01, 0x02 }, sizeof array); 

believe or not, this works.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -