Boost logo

Boost Users :

Subject: Re: [Boost-users] [filesystem] how to set a file size?
From: Bill Buklis (boostuser_at_[hidden])
Date: 2009-10-16 15:13:17


> -----Original Message-----
> >>
> >> There are two posix functions ("truncate" and "ftruncate") which might
> >> do what you need.
> >
> > It doesn't look like these functions exist for MSVC users. So it seems
> > there is no portable way to change the size of a file. Beman, would this
> > make a good addition to the filesystem library?
>
> MSVC offers "_chsize_s" for such a task, which (of course), is not
> available for Linux...

The Windows API version for this is called SetEndOfFile. This is a
truncating type function. I would use this function unless there is really a
need to use the runtime library version.

-- Bill --


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