|
Boost Users : |
Subject: [Boost-users] Can a mapped_file bigger than 2GB be random seeked?
From: Narcélio Filho (narcelio_at_[hidden])
Date: 2015-05-04 02:11:16
Hello!
I'm writting on random positions on a mapped file, but it seems that if I
seek past 2GB, write something, then seek to a lower position, I got a
segfault. Here is the code:
#include <iostream>
#include <fstream>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/device/mapped_file.hpp>
using namespace std;
using boost::iostreams::stream;
using boost::iostreams::mapped_file;
int main(int argc, char** argv)
{
const size_t GIGA = 1024l*1024l*1024l;
const size_t FILESIZE = 2l * GIGA + 10000;
ofstream block("file", ios::binary | ios::out);
assert(block.good());
block.seekp(FILESIZE);
block.write("", 1);
block.close();
mapped_file mappedFile("file");
stream<mapped_file> file(mappedFile, ios::binary¥½Ìèé½ÕФì((
ÍÍÉСµ
ÁÁ¥±¹¥Í}½Á¸ ¤¤ì((¡
ÈÕÉlÄÁtôìÁôì((½ÕÐððÀðð¹°ì(¥±¹ÍÀ À¤ì(¥±¹ÝɥѡÕȰĤì((½ÕÐðð%1M%i´Äðð¹°ì(¥±¹ÍÀ¡%1M%i´Ä¤ì(¥±¹ÝɥѡÕȰĤì((½ÕÐððĨ%ðð¹°ì(¥±¹ÍÀ Ĩ%¤ì(¥±¹ÝɥѡÕȰĤì((ÉÑÕɸÀì)ô(()$½µÁ¥±
¹ÉÕ¸½¸UÕ¹ÑÔÄиÄÀ½
µØÐè((¬¬á
µÁ±¹ÁÀµ±½½ÍÑ}¥½ÍÑÉ
µÌ(À(ÈÄÐÜÐäÌØÐÜ)Mµ¹Ñ
Ñ¥½¸
ձС½ÉÕµÁ¤(()$
±Í¼ÐÑ¡Í
µÉɽȽ¸]¥¹½ÝÌà½
µØи(()]¡
Ð$´½¥¹Ýɽ¹ü(()muÌ°9
É¥±¥¼¸(
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net