问个关于c++读取远程web服务器上面图片文件的有关问题,希望大家来看看

问个关于c++读取远程web服务器上面图片文件的问题,希望大家来看看
因为一直都是没涉及读取web端的文件数据的,所以对这个可能不大了解

比方说,我有这么一个函数,他的功能是读取本地文件的数据,然后进行解密的:

void ImageDecryptShow::ParaseImageAndShow(std::string file_path, std::string decrypt_key)
{
// 需要计算出out_data的大小
ifstream fin_encrypt(file_path, ios::binary);
if (!fin_encrypt)
{
return;
}

fin_encrypt.seekg(0, ios::end);
int file_length_encrypt = fin_encrypt.tellg();

if (out_data_)
{
delete[] out_data_;
out_data_  = NULL;
}
out_data_ = new char[file_length_encrypt + 1];
memset(out_data_, 0, file_length_encrypt + 1);
fin_encrypt.close();

// 从文件中解密到数组中
DecryptRelation::AesDecryptFromFileToBytes( file_path, (unsigned char *)out_data_,
out_data_length_, decrypt_key.c_str(), 16);

LoadMemImage(&image_, out_data_, file_length_encrypt);
}


但是现在,这个file_path是传入的http://127.0.0.1/1.jpg
这个函数,打开就失败了。直接就在

if (!fin_encrypt)
{
return;
}

这里return了。


大家对于这个存在于web端的数据,都是怎么得到的?
------解决方案--------------------
需要有读取网络文件的方法,单靠ifstream 不行。