From 910c0292c6355d5591e289ea6978fdf124ab2221 Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Tue, 3 Dec 2024 14:42:15 +0100 Subject: [PATCH] Shorten README.md --- README.md | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 542c32062..638b3d411 100644 --- a/README.md +++ b/README.md @@ -13,31 +13,23 @@ ## Examples ```c++ -#include - using namespace HighFive; -std::string filename = "/tmp/new_file.h5"; +File file("foo.h5", File::Truncate); { - // We create an empty HDF55 file, by truncating an existing - // file if required: - File file(filename, File::Truncate); - std::vector data(50, 1); file.createDataSet("grp/data", data); } { - // We open the file as read-only: - File file(filename, File::ReadOnly); auto dataset = file.getDataSet("grp/data"); - // Read back, with allocating: + // Read back, automatically allocating: auto data = dataset.read>(); - // Because `data` has the correct size, this will - // not cause `data` to be reallocated: + // Alternatively, if `data` has the correct + // size, without reallocation: dataset.read(data); } ```