C++ 5

c++ 문자열을 배열로 변환(explode) 방법

php 의 explode 와 같이 문자열을 특정 구분자로 배열로 변환해 보겠습니다. #include #include #include #include #include #include #include #include #include std::string exec(const char* cmd) { char buffer[128]; std::string result = ""; FILE* pipe = popen(cmd, "r"); if (!pipe) throw std::runtime_error("popen() failed!"); try { while (fgets(buffer, sizeof buffer, pipe) != NULL) { result += buffer; } } catch (...) { pclose(pip..

프로그래밍/C++ 2021.12.08

c++ system 함수 output 변수에 담아 전달 방법

사용자 정의함수 먼저 선언해야 한다. cpp.cpp #include #include #include #include #include #include std::string exec(const char* cmd) { char buffer[128]; std::string result = ""; FILE* pipe = popen(cmd, "r"); if (!pipe) throw std::runtime_error("popen() failed!"); try { while (fgets(buffer, sizeof buffer, pipe) != NULL) { result += buffer; } } catch (...) { pclose(pipe); throw; } pclose(pipe); return result; } i..

프로그래밍/C++ 2021.12.08

[윈웨이] 로컬에서 docker 파일 실행 + C++ REST SDK + easyOCR 운전면허증

docker a82f5c258527 컨테이너는 이미 C++ REST SDK 설치(컴파일) 되어 있는 컨테이너이다. 일반계정으로 실행하려면 https://trytoso.tistory.com/1588 리눅스 docker 일반 계정으로 실행시 오류 발생 Got permission denied while trying to connect to the Docker daemon 리눅스 docker 일반 계정으로 실행시 오류 발생 Got permission denied while trying to connect to the Docker daemon socket 아래와 같이 일반계정으로 centos8 검색하려는데 에러가 발생했다. 이는 docker 권한.. trytoso.tistory.com # docker exec -..

인프라 2021.11.30

docker centos7 install + C++ REST SDK

docker centos7 설치 centos 찾기 docker search centos docker pull 이미지이름:버전 centos7 설치 docker pull centos:7 이미지 리스트 docker images 도커 컨테이너 실행 docker run -i -t centos:7 /bin/bash 기본 패키지 설치 yum -y update yum -y groupinstall 'Development Tools' yum -y install \ wget \ git \ gcc \ openssl-devel \ bzip2-devel \ python3.x86_64 \ libffi-devel \ g++ \ opencv \ opencv-devel \ opencv-python\ make python3 -m pip ..

인프라 2021.11.30

centos7 c++ 에서 http_client.h install 하는 방법 (rest sdk build)

c++ 에서 아래와 같은 코드를 실행하려고 할때 rest sdk 있어야 함 사전준비 boost 1.54 이상 버전 필요 여기서는 1.61 사용 boost build - 오래걸린다. wget https://sourceforge.net/projects/boost/files/boost/1.61.0/boost_1_61_0.tar.bz2/download # downlaod 이름의 파일로 받아진다. 그러니 이름을 변경해 두자. $ mv download boost_1_61_0.tar.bz2 $ tar -xvf boost_1_61_0.tar.bz2 $ cd boost_1_61_0 $ ./bootstrap.sh Building Boost.Build engine with toolset gcc... tools/build/s..

프로그래밍/C++ 2021.11.02