Google cloud storage C/C++;谷歌云存储库
你知道好的C/C++库吗Google cloud storage C/C++;谷歌云存储库,google-cloud-storage,google-cloud-cpp,Google Cloud Storage,Google Cloud Cpp,你知道好的C/C++库吗 我可以找到它,但用C/C++(或Objective-C)找不到。有一个Google的库列表(包括Objective C)。在Gnome树中有一个用C编写的OAuth2库: 这是Gnome的librest包的一部分,它是一个促进REST事务的库。我自己没有使用过,但以下是一些观察结果: 看起来您需要使用automake来构建.configure。文档说只需运行configure脚本,但文档非常旧。 它仍在开发中(最近一次登记是在2012年12月) 如果你确实尝试过,请报
我可以找到它,但用C/C++(或Objective-C)找不到。有一个Google的库列表(包括Objective C)。在Gnome树中有一个用C编写的OAuth2库: 这是Gnome的librest包的一部分,它是一个促进REST事务的库。我自己没有使用过,但以下是一些观察结果: 看起来您需要使用automake来构建.configure。文档说只需运行configure脚本,但文档非常旧。 它仍在开发中(最近一次登记是在2012年12月)
如果你确实尝试过,请报告你的经历。(谢谢!)< P> GCS有一个支持的C++客户端库。资料来源如下: 完整文档如下所示: 下面是一个下载对象并计算行数的示例:
#include "google/cloud/storage/client.h"
#include <iostream>
namespace gcs = google::cloud::storage;
int countLines(std::string bucket_name, std::string object_name) {
// Create aliases to make the code easier to read.
namespace gcs = google::cloud::storage;
// Create a client to communicate with Google Cloud Storage. This client
// uses the default configuration for authentication and project id.
google::cloud::StatusOr<gcs::Client> client =
gcs::Client::CreateDefaultClient();
if (!client) {
std::cerr << "Failed to create Storage Client, status=" << client.status()
<< "\n";
return 1;
}
gcs::ObjectReadStream stream = client.ReadObject(bucket_name, object_name);
int count = 0;
std::string line;
while (std::getline(stream, line, '\n')) {
++count;
}
return count;
}
#包括“google/cloud/storage/client.h”
#包括
名称空间gcs=google::cloud::storage;
int countLines(std::string bucket\u name,std::string object\u name){
//创建别名以使代码更易于阅读。
名称空间gcs=google::cloud::storage;
//创建与Google云存储通信的客户端。此客户端
//对身份验证和项目id使用默认配置。
google::cloud::StatusOr客户端=
gcs::Client::CreateDefaultClient();
如果(!客户端){
谢谢你的信息。事实上,我使用AmazonS3而不是Google云存储完成了我的任务。S3-有一个开源的C库。