c++ string 与 char 互转
很简单如下
char bts[5] = {'A','B','C','D','E'}; printf("%s\n",bts); //char to string std::string strBts = bts; std::cout << strBts << std::endl; //string to char char *theBts = (char *)strBts.c_str(); printf("%s\n",theBts);
c++ base64 工具
// // base64.h // CPPWork // from http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c // Created by cocoa on 16/8/5. // Copyright © 2016年 cc. All rights reserved. // #ifndef base64_h #define base64_h #include <string> std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len); std::string base64_decode(std::string const& encoded_string); #endif /* base64_h */