I just want to read a txt file and receive a string file like that
Blob rgbBlob;
string strIccRGBFile = "./icc/RGB.icc";
string strIccRGBContent = LoadFile(strIccRGBFile);
rgbBlob.update(strIccRGBContent.c_str(), strIccRGBContent.length());
image.profile("ICM", rgbBlob);
How I implement LoadFile function
#include <fstream>
#include <string>
int main()
{
std::string buff;
std::fstream fs("filename",std::ios::in | std::ios::ate)
if(fs.is_open())
{
fstream::pos_type size = fs.tellg();
fs.seekg(0);
buff.resize(size);
fs.read(&buff[0],size);
}
std::cout << buff << endl;
}
this is an example of how to read a file in it's entirety to a string buffer. It should give you a good idea on how to proceed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.