Everything I\'m finding via google is garbage... Note that I want the answer in C, however if you supplement your answer with a C++ solutio
float f;
if(read(fd,&f,sizeof(f))==sizeof(f))
printf("%f\n",f);
else
printf("oops\n");
Provided that it's written as compatible binary representation.
read
for file descriptors, fread
for FILE*
s and istream::read
for c++
iostreams. Pick whatever pleases you:
read(fd,&f,sizeof(f))==sizeof(f)
fread(&f,sizeof(f),1,fp)==1
fin.read((char*)&f,sizeof(f)).gcount()==sizeof(f)