I need to write unsigned long long integer values to a text file. When I used fprintf() it works perfectly but, takes time. I have profiled my application and fprintf() takes the half of all time. I have made a research and I saw that, fwrite() is more effective than fprintf(). But I couldn't managed how to use it?
My code with fprintf()
fprintf(out, "%llu %llu\n", min, minv);
My code with fwrite()
fwrite(&min,sizeof(unsigned long long int),1, out);
fputs(" ",out);
fwrite(&minv,sizeof(unsigned long long int),1, out);
fputs("\n", out);
fwrite() is faster the first one but when I opened the file, the data is like
¾²ö `àÔàUü
ؾ{4- "¤#sÏ$P
oD/
-5X®Z
How could I perform fwrite() properly in this situation?