Skip to content

Commit

Permalink
Improve Attribute example. (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored May 22, 2023
1 parent 3578389 commit b5d67bd
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/examples/create_attribute_string_integer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ int main(void) {

Attribute v = dataset.createAttribute("version", version);

// We can also create attributes on the file:
file.createAttribute("file_version", 1);

// and on groups in the file:
auto group = file.createGroup("group");
group.createAttribute("secret", 123);

// let's now list the keys of all attributes
std::vector<std::string> all_attributes_keys = dataset.listAttributeNames();
for (const auto& attr: all_attributes_keys) {
Expand Down

0 comments on commit b5d67bd

Please sign in to comment.