- #1
- 162
- 203
In C#,
which is to convert 2 bytes 4 and 5 to a short value.
I'd like to do this in C++
So I do
but this is not correct. there is not method to export a short, I consider also the system type (big/little endian) my code must run on. Any help please ... :)
PHP:
byte[] tail={...}
short reader = BitConverter.ToInt16(tail, 4);
I'd like to do this in C++
So I do
PHP:
char tail[]={...}
short reader=toInt16(tail,4);
...
short toInt16(char*tail,int index)
{
int n=index;
int m=n+1;
string s(tail[n]);
s+=tail[m];
return atoi(s.c_str());
}