我从微信传上来的图片(jpg)使用如下代码
string x1=""; fstream r1; r1.open("D:\\1.jpg");//图片路径 if(!r1.is_open()){ cout<<"打开文件时错误\n"; system("pause"); return 0; } string a=""; while(!r1.eof()){ r1>>a;//格式不重要 x1+=a; } r1.close(); cout<<x1;
读取的时候为什么读取内容与实际内容不同啊,而Baidu图库下载下来的就是正常的读取