summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorpengxuanzheng <[email protected]>2020-09-11 16:13:02 +0800
committerpengxuanzheng <[email protected]>2020-09-11 16:13:02 +0800
commitcd0649bfbcadaeca8d7e37b31d3e9a191160ce04 (patch)
tree90e25d35da4fc1087ad07fb7c6cd321b66a5811f /example
init
Diffstat (limited to 'example')
-rw-r--r--example/CMakeLists.txt10
-rw-r--r--example/single_thread.cpp25
2 files changed, 35 insertions, 0 deletions
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
new file mode 100644
index 00000000..ff606acf
--- /dev/null
+++ b/example/CMakeLists.txt
@@ -0,0 +1,10 @@
+cmake_minimum_required(VERSION 3.5)
+set(CMAKE_BUILD_TYPE Debug)
+project(singleThread)
+
+link_directories(/usr/local/lib64/)
+#set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR})
+add_executable(singleThread single_thread.cpp)
+target_link_libraries(singleThread hos_client_cpp)
+
+#install(TARGETS singleThread DESTINATION ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/example/single_thread.cpp b/example/single_thread.cpp
new file mode 100644
index 00000000..71ddc4d5
--- /dev/null
+++ b/example/single_thread.cpp
@@ -0,0 +1,25 @@
+/*************************************************************************
+ > File Name: single_thread.cpp
+ > Author: pxz
+ > Created Time: Fri 11 Sep 2020 09:52:05 AM CST
+ ************************************************************************/
+#include<stdio.h>
+#include"../src/hos_client.h"
+
+int main(int argc, char *argv[])
+{
+ hos_client_handle handle = hos_client_init("192.168.44.12:9098/hos", "default", "defalut");
+ if (handle == NULL)
+ {
+ printf("error:hos_client_handle\n");
+ return -1;
+ }
+
+ hos_create_bucket(handle, "my-first-bucket");
+
+ hos_upload_async(handle, "my-first-bucket", "my-file.txt");
+
+ hos_client_close(handle);
+
+ return 0;
+}