Konwertuj bajty na Int / uint w C

Mam tablicę char unsigned [248]; wypełnione bajtami. Podobnie jak 2F AF FF 00 EB AB CD EF ..... Ta macierz to mój strumień bajtów, który przechowuję moje dane z UART (RS232) jako bufor.

Teraz chcę przekonwertować bajty z powrotem na moje uint16 i int32.

W C # użyłem klasy BitConverter, aby to zrobić. na przykład:

byte[] Array = { 0A, AB, CD, 25 };
int myint1 = BitConverter.ToInt32(bytes, 0);
int myint2 = BitConverter.ToInt32(bytes, 4);
int myint3 = BitConverter.ToInt32(bytes, 8);
int myint4 = BitConverter.ToInt32(bytes, 12);
//...
enter code here
Console.WriteLine("int: {0}", myint1); //output Data...

Czy istnieje podobna funkcja w C? (bez .net, używam kompilatora KEIL, ponieważ kod działa na mikrokontrolerze)

Z poważaniem Sam

questionAnswers(4)

yourAnswerToTheQuestion