Topic: truncate file


Author: Frank Birbacher <bloodymir.crap@gmx.net>
Date: Mon, 10 Sep 2007 21:55:47 CST
Raw View
Hi!

I know the boost::filesystem library was formed to a proposal for the
new standard. This library includes some operations on files. And I
wonder why this still does not include truncation of files to a
specified size.

Is there not need to truncate files? It can't be done in standard C++
without rewriting/copying the remaining file contents. But at least in
Windows and Linux I have implemented just that: truncate a file (which
isn't opened by any program) to a given size. Shouldn't this be provided
by the standard library?

Frank

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "Jim Langston" <tazmaster@rocketmail.com>
Date: Tue, 11 Sep 2007 09:38:41 CST
Raw View
"Frank Birbacher" <bloodymir.crap@gmx.net> wrote in message
news:5kl9ubF4brhcU1@mid.dfncis.de...
> Hi!
>
> I know the boost::filesystem library was formed to a proposal for the
> new standard. This library includes some operations on files. And I
> wonder why this still does not include truncation of files to a
> specified size.
>
> Is there not need to truncate files? It can't be done in standard C++
> without rewriting/copying the remaining file contents. But at least in
> Windows and Linux I have implemented just that: truncate a file (which
> isn't opened by any program) to a given size. Shouldn't this be provided
> by the standard library?

If you have implemented it in Windows or Linux, then you can implement it in
C++, even if it means having to call the system() function.  So why should
it have to be added to the standard?  It's not something that many people
ever need to do.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Jack Klein <jackklein@spamcop.net>
Date: Tue, 11 Sep 2007 09:37:03 CST
Raw View
On Mon, 10 Sep 2007 21:55:47 CST, Frank Birbacher
<bloodymir.crap@gmx.net> wrote in comp.std.c++:

> Hi!
>
> I know the boost::filesystem library was formed to a proposal for the
> new standard. This library includes some operations on files. And I
> wonder why this still does not include truncation of files to a
> specified size.
>
> Is there not need to truncate files? It can't be done in standard C++
> without rewriting/copying the remaining file contents. But at least in
> Windows and Linux I have implemented just that: truncate a file (which
> isn't opened by any program) to a given size. Shouldn't this be provided
> by the standard library?
>
> Frank

Frank,

I don't want to rehash the limited discussion that followed your
identical post on comp.lang.c++.moderated about a week ago.

But I have thought of one question I would like to ask you, namely,
have you tried asking the boost developers, via their mailing list or
other contact method, why they did not include this feature in the
library?

If you did, what reply did you get?

If you did not, why not ask them?  They might well provide a reason
that you would find convincing.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.club.cc.cmu.edu/~ajo/docs/FAQ-acllc.html

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]