以下代码:
auto storage_account = azure::storage::cloud_storage_account::parse(location.ConnectionString);
auto blob_client = storage_account.create_cloud_blob_client();
auto container = blob_client.get_container_reference(location.Container);
auto blockBlob = container.get_block_blob_reference(location.File);
auto istream = blockBlob.open_read();
uint32_t content;
while(!istream.is_eof())
{
istream >> content;
std::cout << "Read from blob:" << content << std::endl;
}
永远产生输出“从blob:0读取”。所使用的输入文件仅在单独的行上具有文本1-4。
首先将整个blob读取到内存中
concurrency::streams::container_buffer<std::vector<char>>& readBuffer = *blob.Read();
vectorwrapbuf<char> buf(readBuffer.collection());
std::istream readThis(&buf);
其中vectorwrapbuf封装了读取的基础内存块,因此可以在istream中使用。
问题是-简单版本怎么了?