In many projects, I saw that data object/structure are written into file in binary mode, and then retrieve them back from the file in binary mode again.
I wonder why
In binary mode you have got a size of byte(consider 256 ) to be utilized and in text mode its hardly more than 100 characters. Obviously you are going to gain more than double size for storing data.
Further there are cases where you have to abide by structure specification such as a network packet like IPv4.
Let us take an example
//No padding
typedef struct abc
{
int a:4
char b;
double c;
} A[]={{.a=4,.b='a',.c=7.45},{.a=24,.b='z',.c=3.2}} ;
Isn't it difficult to store bit fields in text mode.obviously you gonna loose so many things.
However you can save data object in text format as done using MIME,but it will require an extra routine to to convert in binary mode; Performance hammered.