🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #388

Memory mapped file question

#388
From: Totte Karlsson
Date: Sat, 19 Apr 2008 01:40
15 lines
1396 bytes
Hi,
I'm planning on using memory mapped files to write data to a file. The files can 
be of any size between 0 bytes to to 2GB (not larger).

My "problem" is, when I open the memory mapped file, I don't know how big it 
will be, i.e. h ow many bytes that I will write to it. And it seems that memory 
mapped files can't grow easily. So I thought I would open each file as 2 GB 
large initially and then, when I have written my bytes, say 1.38 GB, I would 
truncate the rest of the file.

Is that possible/feasible? Any simple answer on how to remove x bytes in a file 
from the end of file?

regards
-totte
Technical Details
Message-ID: <48094dc2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,be92db2618fc0f73,start
X-Google-Attributes: gid10cc67,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Fri, 18 Apr 2008 18:40:43 -0700
From: Totte Karlsson <tottek@gmail.com>
User-Agent: Thunderbird 2.0.0.12 (Windows/20080213)
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Memory mapped file question
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 75.165.79.45
Message-ID: <48094dc2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1208569282 75.165.79.45 (18 Apr 2008 18:41:22 -0700)
Lines: 15
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!feeder.news-service.com!news.isoc.lu!newsgroups.borland.com!not-for-mail