//////////////////////////////////////////////////////
float f;
f=-3.14/100;
cout<<f<<endl;
char fw[4];
memcpy(fw,&f,sizeof(float));
//char fw[]<float <f
ofstream ofs( "floatio.bin" ,ios::out|ios::binary) ;//output
ofs.write(fw,sizeof(float));
ofs.close();
//file<<char fw[]
char fr[4];
ifstream ifs( "floatio.bin" ,ios::in|ios::binary) ;
ifs.read(fr,sizeof(float));
//char fr[]<<file
float f2;
memcpy(&f2,fr,sizeof(float));
//float f2<<char fr[]
cout<<f2<<endl;
float f3;
memcpy(&f3,&f2,sizeof(float));
//float f3 << float f2;
cout<<f3;
///////////////////////////////////////////
出力結果
-0.0314
-0.0314
-0.0314
char[]にコピーするのが無駄な処理です。
速度が低下しまし、メモリも余分に使いますし、ソースも無駄に大きくなって読みにくいです。
直接、float型を書き込めば一回ですみます。
float f;
ofs.write((char *)&f,sizeof(float));
が普通の使い方です。
二度手間の無意味な代入はやめましょう。
バーバリーコート http://www.burberrymore.com
バーバリーベルト http://www.burberrymore.com/7--
バーバリーマフラー http://www.burberrymore.com/10--
バーバリー時計 http://www.burberrymore.com/11-watches
バーバリー靴 http://www.burberrymore.com/9--shoes
モンクレール ダウン http://www.burberrymore.com/17-downjacket
モンクレール ダウンレディース http://www.burberrymore.com/20--
モンクレール ダウンメンズ http://www.burberrymore.com/19--
VVK:http://www.chinakanpo.com/Product/wk.html
WENICKMAN:http://www.chinakanpo.com/Product/wenick.html
威哥王:http://www.chinakanpo.com/product/wgwsbl.html
新曲美:http://www.chinakanpo.com/product/xinqumei.html
脂肪燃焼:http://www.chinakanpo.com/catalog/28.html
曲美:http://www.chinakanpo.com/product/qumei.html
新一粒神:http://www.chinakanpo.com/Product/xyls.html
三便宝:http://www.shanghaikanpo.com/view/1425.html
VigRx:http://www.shanghaikanpo.com/view/1165.html
vigRx oil:http://www.shanghaikanpo.com/view/1166.html
女性用媚薬:http://www.shanghaikanpo.com/Charming-medicine.html
VVK:http://www.shanghaikanpo.com/view/1158.html
Wenickman:http://www.shanghaikanpo.com/view/1156.html
Ray Ban/レイバン 通販:http://www.raybans.jp
レイバン サングラス:http://www.raybans.jp/category-1-b0.html
レイバン ウェイファーラー:http://www.raybans.jp/category-2-b0.html
レイバン 偏光サングラス:http://www.raybans.jp/category-3-b0.html
ANNA SUI/アナスイ:http://www.fashionworld.jp
アナスイ 通販:http://www.fashionworld.jp
アナスイ 財布:http://www.fashionworld.jp/category-58-b0.html
アナスイ バッグ 通販:http://www.fashionworld.jp/category-73-b0.html
アナスイ 傘:http://www.fashionworld.jp/category-75-b0.html
http://isabelle.ex5.biz/
http://zhongsheng10.seesaa.net/
http://linksinfostore.mamagoto.com/
http://tanakamiki.blog.shinobi.jp
http://blog.livedoor.jp/tanakakumi77/
http://tanakarimi77.blog.shinobi.jp
http://tanakarimi77.seesaa.net/
http://tanakasami.fruitblog.net
http://familyhealthy.blog.so-net.ne.jp/
http://raybanonline.arekao.jp/
http://raybanonline.fruitblog.net
http://inublo.jp/blog/raybanonline
http://www.cafeblo.com/rayban/
http://zhongsheng9.blog.shinobi.jp/