MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/cpp-samples / HelloWorld

Function HelloWorld

setup/hello_world.cc:21–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19#include <string>
20
21void HelloWorld(std::string const& bucket_name) {
22 namespace gcs = ::google::cloud::storage;
23 auto client = gcs::Client();
24
25 auto const object_name = std::string{"hello-world.txt"};
26 auto metadata = client.InsertObject(bucket_name, object_name, "Hello World!");
27 if (!metadata) throw std::move(metadata).status();
28
29 auto is = client.ReadObject(bucket_name, object_name);
30 std::cout << std::string{std::istreambuf_iterator<char>{is}, {}} << "\n";
31 if (is.bad()) throw google::cloud::Status(is.status());
32}
33// [END cpp_hello_world]
34
35int main(int argc, char* argv[]) try {

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected