Hey, I was hoping someone can help me convert a piece of php code, im not really sure where to start pack( 'v', $test ); The pack php function above takes in an integer and converts it to an unsigned long. V - unsigned long (always 32 bit, little endian byte order - is the php documentation of the function. But im told java stores as big endian? So any help on how to convert the integer to an unsigned little endian long would be helpful, i assume a simple type cast would convert to a big endian based number …

Member Avatar
Member Avatar
+0 forum 6

Hi All, I am trying to understand shift operator which is used in my project. What I came to know from google is that Bit shifting allows for compact storage of similar data as a single integral value. But how does that work. and what is the advantage. Can you explain me the part below program whats exactly happening in below lines. The code is taken from [url]http://www.codeproject.com/KB/graphics/dicomImageViewer.aspx[/url] (Tnx to Amarnath S) int vr = (b0 << 8) + b1; and case UT: ?? This programe reads a binary file, in medical terms a dicom file, which is basically a …

Member Avatar
Member Avatar
+0 forum 1

Hi I have a problem with a code I made, some save editor for some game. The code suppose to write 2 bytes to a specific offset in some file. The file's short integers are saved as little endian. everything works fine, but when one of the integers equal 10, it is saved as another number. my function to write the short integers is: [CODE] void writeInt(int n, int pos, fstream* file) { char tmp[2]; tmp[0] = n & 0xff; tmp[1] = (n >> 8) & 0xff; file->seekp(pos, ios::beg); file->write(tmp, 2); }[/CODE] I call this function in the function: [CODE] …

Member Avatar
Member Avatar
+0 forum 2

The End.