Copying two unsigned char[] into unsigned char[]

1
2
3
4
5
6
           unsigned char key[32];
139         unsigned char rfseed[32];              
173                 f = fopen("/dev/urandom","rb");
174                 fread(key,1,32,f);
175                 fread(rfseed,1,32,f);


Hello, I am having problems copying outputs of the above code into other unsigned char other[32].
I need to keep the output of dev/urandom for backup.
But, when I try to assign the values by memcpy(other, key, 32), the values do not match. The same problem happens by assigning values index by index in a loop.
Help.
If you print out the integral values of each array to the console, what does it look like? Are you getting garbage?
I am not sure, I found a solution that might be temporary, but stringstream seems to get the right values. So, it's probable a problem with the outputof dev/urandom. Urandom sometimes returns a variable size "random" sequence of characters.

Anyone knows exactly what's going on?

Topic archived. No new replies allowed.