[cwrap] Update README.md (#3324)
author남궁석/On-Device Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com>
Sun, 21 Apr 2019 23:26:02 +0000 (08:26 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Sun, 21 Apr 2019 23:26:02 +0000 (08:26 +0900)
This commit will update README.md

Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
contrib/cwrap/README.md

index f4f44b0..64c8084 100644 (file)
@@ -1,3 +1,25 @@
-## What is "cwrap"?
+## cwrap
+
+### Purpose
 
 _cwrap_ is a collection of C++ wrappers for POSIX C API.
+
+### How to use
+
+Currently it supports only file descriptor.
+
+### Example
+- File Descriptor
+
+```cpp
+cwrap::Fildes fildes{open(path.c_str(), O_RDONLY)};
+
+if (fildes.get() < 0)
+{
+    std::ostringstream ostr;
+    ostr << "Error: " << path << " not found" << std::endl;
+    throw std::runtime_error{ostr.str()};
+}
+
+google::protobuf::io::FileInputStream fis(fildes.get());
+```