"C"의 두 판 사이의 차이
ph
(새 문서: ==Read/write float binary== [https://stackoverflow.com/q/1422817/766330 How to read a float from binary file in C?] / [https://stackoverflow.com/a/1422854/766330 answer] <pre> void w...) |
(차이 없음)
|
2017년 8월 3일 (목) 18:47 판
Read/write float binary
How to read a float from binary file in C? / answer
void writefloat(float v, FILE *f) {
fwrite((void*)(&v), sizeof(v), 1, f);
}
float readfloat(FILE *f) {
float v;
fread((void*)(&v), sizeof(v), 1, f);
return v;
}