I am using quadmath library for quad-precision. Can I use fwrite function to write to binary file?
struct rec
{
__float128 mydata;
}
struct rec my_record;
mydata=1.41421356237309504880q;
fwrite(&my_record, sizeof(struct rec), 1, myfile);
I am using quadmath library for quad-precision. Can I use fwrite function to write to binary file?
struct rec
{
__float128 mydata;
}
struct rec my_record;
mydata=1.41421356237309504880q;
fwrite(&my_record, sizeof(struct rec), 1, myfile);
You should have no problem writing to a file. As long as you read it back in the same way (i.e. with
fread) and the file isn't copied between machines you should be fine.You also don't need to encapsulate the value in a struct to do this: