Boost logo

Boost :

Subject: Re: [boost] [afio] Trouble with examples
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2015-05-03 15:34:37

On 3 May 2015 at 21:02, Brian Ravnsgaard Riis wrote:

> The first two examples for the AFIO library do not work as written.


> The "Hello World" example is missing a file_flag::Create[OnlyIfNotExist]
> flag on the "example_file.txt" op. Otherwise it never creates the file
> and the rest of the example becomes garbage.


> The "less toy" example has a bug in the parsing of the input files. It
> loops, incrementing argc instead of n, as it should. Even after that I
> cannot get the program to work, and I am unsure exactly what is wrong.
> The output file for the concatenated inputs is created and "truncated"
> to the correct size, but no data ever gets written to this file. If I
> use large files I have seen std::invalid_argument exceptions and even
> segfaults. I *think* the problem may be related to the buffers; I have
> tried using a simple std::vector<char> for the file_buffer_type, but
> this makes no difference.

I do apologise.

The examples are compiled as part of testing, but not executed and
the older examples probably have experienced some regex find and
replace in files bitrot as various refactorings have occurred. I'll
be honest in saying I gave them very little thought in the v1.3
release as they'll all need to be rewritten for the Fiber support
coming in v1.4.

Firstly, can you report the above issues at please? I probably
won't attend to them for a bit as C++ Now is very close and I'm

Secondly, don't forget there is a wealth of definitely working
example code in the unit tests. From v1.4 onwards I intend to make
the examples also unit tests as I myself have found examples in the
docs which had become non-functional over time.

And if you have any problems with code failing, please do post
problems onto boost-users.


ned Productions Limited Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at