Hi,
The write
function does not print a floating point number in the following code:
#include <unistd.h>
int main(){
float f = 4.5;
write(1,&f,sizeof float);
return 0;
}
This results in:
�@
Whereas:
int main(){
char *c = "Hello world";
write (1,c,strlen(c)+1);
return 0;
}
Prints Hello world
as expected.
What am I missing?
Thanks in advance.