Skip to content

Commit e49dc46

Browse files
authored
chore: sync cpp example (#5944)
Signed-off-by: Mingzhuo Yin <[email protected]>
1 parent eb9cedb commit e49dc46

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

examples/cpp/basic.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
#include <iostream>
66

77
int main() {
8-
char s[] = "memory";
98
std::vector<uint8_t> data = {'a', 'b', 'c'};
109

1110
// Init operator
12-
opendal::Operator op = opendal::Operator(s);
11+
opendal::Operator op = opendal::Operator("memory");
1312

1413
// Write data to operator
1514
op.write("test", data);
@@ -19,8 +18,8 @@ int main() {
1918

2019
// Using reader
2120
auto reader = op.reader("test");
22-
opendal::ReaderStream stream(reader);
21+
opendal::ReaderStream stream(std::move(reader));
2322
std::string res2;
2423
stream >> res2; // res2 == "abc"
25-
std::cout<<res2<<std::endl;
26-
}
24+
std::cout << res2 << std::endl;
25+
}

0 commit comments

Comments
 (0)