boost regex 获取 FTP 响应响应消息,boostregex,boost regex获
boost regex 获取 FTP 响应响应消息,boostregex,boost regex获
boost regex获取FTP消息
#include <stdlib.h>#include <boost/regex.hpp>#include <string>#include <iostream>using namespace boost;regex expression("([0-9]+)(\\-| |$)(.*)");// process_ftp: // on success returns the ftp response code, and fills // msg with the ftp response message. int process_ftp(const char* response, std::string* msg){ cmatch what; if(regex_match(response, what, expression)) { // what[0] contains the whole string // what[1] contains the response code // what[2] contains the separator character // what[3] contains the text message. if(msg) msg->assign(what[3].first, what[3].second); return std::atoi(what[1].first); } // failure did not match if(msg) msg->erase(); return -1;
相关内容
- Python爬取红黑联盟读书频道的图书,python读书频道,2.
- Learn Python By Practice — Utilities模块,pythonutilities,Utilit
- Google Python Class练习解答1-string1.py,python1-string1.py,stri
- Learn Python By Practice — 排序和元组,pythonpractice,排序和
- 用urllib按照百度音乐分类下载mp3,urllib百度音乐mp3,[P
- 从1到10的循环方式改进,10循环方式改进,换一种循环方
- python的一些好的非主流语法用法,python非主流语法,#编
- Learn Python By Practice — Range和Slice扩展学习,pythonslice,
- HTMLParser笔记,,[Python]代码#-
- Learn Python By Practice — 文件读写,,import sysim
评论关闭