Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 2cfb208

Browse files
committed
Shorten README.md
1 parent 44172d0 commit 2cfb208

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

README.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,23 @@
1313
## Examples
1414

1515
```c++
16-
#include <highfive/highfive.hpp>
17-
1816
using namespace HighFive;
1917

20-
std::string filename = "/tmp/new_file.h5";
18+
File file("foo.h5", File::Truncate);
2119

2220
{
23-
// We create an empty HDF55 file, by truncating an existing
24-
// file if required:
25-
File file(filename, File::Truncate);
26-
2721
std::vector<int> data(50, 1);
2822
file.createDataSet("grp/data", data);
2923
}
3024

3125
{
32-
// We open the file as read-only:
33-
File file(filename, File::ReadOnly);
3426
auto dataset = file.getDataSet("grp/data");
3527

36-
// Read back, with allocating:
28+
// Read back, automatically allocating:
3729
auto data = dataset.read<std::vector<int>>();
3830

39-
// Because `data` has the correct size, this will
40-
// not cause `data` to be reallocated:
31+
// Alternatively, if `data` has the correct
32+
// size, without reallocation:
4133
dataset.read(data);
4234
}
4335
```

0 commit comments

Comments
 (0)