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 */
View Code

相关文章:

  • 2022-12-23
  • 2021-07-13
  • 2021-12-25
  • 2022-02-27
  • 2021-06-16
  • 2021-11-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案