From 3e1fc8333755912e73c0a1501cddcb6496e5db52 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=82=A8=EA=B6=81=EC=84=9D/On-Device=20Lab=28SR=29/Enginee?= =?utf8?q?r/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Mon, 22 Apr 2019 08:26:02 +0900 Subject: [PATCH] [cwrap] Update README.md (#3324) This commit will update README.md Signed-off-by: Seok NamKoong --- contrib/cwrap/README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/contrib/cwrap/README.md b/contrib/cwrap/README.md index f4f44b0..64c8084 100644 --- a/contrib/cwrap/README.md +++ b/contrib/cwrap/README.md @@ -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()); +``` -- 2.7.4