91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 11.58MB
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-06-26
  • 語言: C/C++
  • 標(biāo)簽: json解析??base64??c++??

資源簡介

在前人的基礎(chǔ)上增加了json解析封裝得到base64或反轉(zhuǎn)成文件。包括案例,源代碼。 調(diào)用簡單,不錯(cuò)的學(xué)習(xí)案例。 std::unique_ptrp(new const char*(readfile64("{\"filename\":\"D:\\\\job\\\\greatwall\\\\test\\\\1.jpg\"}"))); if (!*p.get()) return -1; int len = strlen(*p.get()); printf("%s\n",*p.get()); char* pcOut = new char[len + MAX_PATH]; memset(pcOut,0x00,sizeof(pcOut)); sprintf(pcOut,"{\"base64\":\"%s\",\"filename\":\"%s\"}",*p.get(),"D:\\\\job\\\\greatwall\\\\test\\\\out.jpg"); //const char* ret = _64tofile(pcOut); std::unique_ptrret(new const char*(_64tofile(pcOut))); printf("%s\n",*ret.get());

資源截圖

代碼片段和文件信息

/*
??Copyright?(c)?2005-2009?by?Jakob?Schroeter?
??This?file?is?part?of?the?gloox?library.?http://camaya.net/gloox

??This?software?is?distributed?under?a?license.?The?full?license
??agreement?can?be?found?in?the?file?LICENSE?in?this?distribution.
??This?software?may?not?be?copied?modified?sold?or?distributed
??other?than?expressed?in?the?named?license?agreement.

??This?software?is?distributed?without?any?warranty.
*/
#include?“stdafx.h“
#include?“base64.h“

namespace?gloox
{

??namespace?base64
??{

????static?const?std::string?alphabet64(?“ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/“?);
????static?const?char?pad?=?‘=‘;
????static?const?char?np??=?(char)std::string::npos;
????static?char?table64vals[]?=
????{
??????62?np?np?np?63?52?53?54?55?56?57?58?59?60?61?np?np?np?np?np
??????np?np??0??1??2??3??4??5??6??7??8??9?10?11?12?13?14?15?16?17
??????18?19?20?21?22?23?24?25?np?np?np?np?np?np?26?27?28?29?30?31
??????32?33?34?35?36?37?38?39?40?41?42?43?44?45?46?47?48?49?50?51
????};

????inline?char?table64(?unsigned?char?c?)
????{
??????return?(?c??122?)???np?:?table64vals[c-43];
????}

????const?std::string?encode64(?const?std::string&?input?)
????{
??????std::string?encoded;
??????char?c;
??????const?std::string::size_type?length?=?input.length();

??????encoded.reserve(?length?*?2?);

??????for(?std::string::size_type?i?=?0;?i???????{
????????c?=?static_cast(?(?input[i]?>>?2?)?&?0x3f?);
????????encoded?+=?alphabet64[c];

????????c?=?static_cast(?(?input[i]?<????????if(?++i???????????c?=?static_cast(?c?|?static_cast(?(?input[i]?>>?4?)?&?0x0f?)?);
????????encoded?+=?alphabet64[c];

????????if(?i?????????{
??????????c?=?static_cast(?(?input[i]?<??????????if(?++i?????????????c?=?static_cast(?c?|?static_cast(?(?input[i]?>>?6?)?&?0x03?)?);
??????????encoded?+=?alphabet64[c];
????????}
????????else
????????{
??????????++i;
??????????encoded?+=?pad;
????????}

????????if(?i?????????{
??????????c?=?static_cast(?input[i]?&?0x3f?);
??????????encoded?+=?alphabet64[c];
????????}
????????else
????????{
??????????encoded?+=?pad;
????????}
??????}

??????return?encoded;
????}

????const?std::string?decode64(?const?std::string&?input?)
????{
??????char?c?d;
??????const?std::string::size_type?length?=?input.length();
??????std::string?decoded;

??????decoded.reserve(?length?);

??????for(?std::string::size_type?i?=?0;?i???????{
????????c?=?table64(input[i]);
????????++i;
????????d?=?table64(input[i]);
????????c?=?static_cast(?(?c?<>?4?)?&?0x3?)?);
????????decoded?+=?c;
????????if(?++i?????????{
??????????c?=?input[i];
??????????if(?pad?==?c?)
????????????break;

??????????c?=?table64(input[i]);
??????????d?=?static_cast(?(?(?d?<

?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----

?????文件???????3335??2018-04-11?10:53??base64_file\base64_file\base64.cpp

?????文件???????1194??2014-03-26?11:27??base64_file\base64_file\base64.h

?????文件???????4481??2018-04-11?11:40??base64_file\base64_file\base64_file.cpp

?????文件????????130??2018-04-11?11:35??base64_file\base64_file\base64_file.h

?????文件???????2644??2018-04-11?09:39??base64_file\base64_file\base64_file.rc

?????文件???????4801??2018-04-11?10:50??base64_file\base64_file\base64_file.vcxproj

?????文件???????2078??2018-04-11?10:50??base64_file\base64_file\base64_file.vcxproj.filters

?????文件????????143??2018-04-11?09:39??base64_file\base64_file\base64_file.vcxproj.user

?????文件??????27790??2018-03-21?15:56??base64_file\base64_file\cJSON.c

?????文件???????7526??2015-02-13?18:53??base64_file\base64_file\cJSON.h

?????文件???????1441??2009-10-13?00:24??base64_file\base64_file\macros.h

?????文件???????2070??2018-04-11?09:39??base64_file\base64_file\ReadMe.txt

?????文件????????394??2018-04-11?09:39??base64_file\base64_file\Resource.h

?????文件????????216??2018-04-11?09:39??base64_file\base64_file\stdafx.cpp

?????文件????????818??2018-04-11?09:39??base64_file\base64_file\stdafx.h

?????文件????????236??2018-04-11?09:39??base64_file\base64_file\targetver.h

?????文件???57692160??2018-04-11?12:04??base64_file\base64_file.sdf

?????文件????????900??2018-04-11?09:39??base64_file\base64_file.sln

????..A..H.?????16896??2018-04-11?12:04??base64_file\base64_file.suo

?????目錄??????????0??2018-04-11?09:40??base64_file\ipch\base64_file-53c058d8

?????目錄??????????0??2018-04-11?12:04??base64_file\base64_file

?????目錄??????????0??2018-04-11?09:40??base64_file\ipch

?????目錄??????????0??2018-04-11?12:04??base64_file

-----------?---------??----------?-----??----

?????????????57769253????????????????????23


評(píng)論

共有 條評(píng)論