Hallo seth,
aber es muss doch auch moeglich sein, einfach die bytes ohne grosse zeitraubende umschweife auszugeben.
Nun, caste den Zeiger auf Deine Float-Variable als Zeiger auf eine Byte-Variable und verwende diese als Array mit sizeof(float) Elementen:
#include <sys/types.h>
#include <stdio.h>
#include <stdint.h>
int main (int argc, char **argv) {
float v = 3.141592;
uint8_t *p = (uint8_t *)&v;
size_t i;
printf ("Float-Wert %f hat die Byte-Darstellung 0x", v);
for (i = 0; i < sizeof (float); i++) {
printf ("%02x", p[i]);
}
printf ("\n");
return 0;
}
Viele Grüße,
Christian
--
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." - Bjarne Stroustrup
"I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone." - Bjarne Stroustrup