# HG changeset patch # User Paper <37962225+mrpapersonic@users.noreply.github.com> # Date 1611397225 18000 # Node ID b3d9104ad918a018a719c0a6baf94bbd40cff417 # Parent 0ea9cae1339b6b7736da95fcb534ee39b43b971b Rename decode.cpp to decodeurl.cpp committer: GitHub diff -r 0ea9cae1339b -r b3d9104ad918 decode.cpp --- a/decode.cpp Sat Jan 23 05:18:44 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -// requires libcurl -#include -#include -#include -#include - -int main(int argc, char * argv[]) { - if (argc != 3) { - std::cout << "usage: " << argv[0] << " "; - return 0; - } - std::string encoded; - CURL * curl = curl_easy_init(); - char somedata[256]; - std::ifstream in (argv[1], std::ios:: in | std::ios::binary); - if (in) { - in .seekg(0, std::ios::end); - encoded.resize( in .tellg()); in .seekg(0, std::ios::beg); in .read( & encoded[0], encoded.size()); in .close(); - } - int outlength; - char * cres = curl_easy_unescape(curl, encoded.c_str(), encoded.length(), & outlength); - std::string res(cres, cres + outlength); - curl_free(cres); - curl_easy_cleanup(curl); - std::ofstream myfile2; - myfile2.open(argv[2]); - myfile2 << res; - myfile2.close(); - return 0; -} \ No newline at end of file diff -r 0ea9cae1339b -r b3d9104ad918 decodeurl.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/decodeurl.cpp Sat Jan 23 05:20:25 2021 -0500 @@ -0,0 +1,30 @@ +// requires libcurl +#include +#include +#include +#include + +int main(int argc, char * argv[]) { + if (argc != 3) { + std::cout << "usage: " << argv[0] << " "; + return 0; + } + std::string encoded; + CURL * curl = curl_easy_init(); + char somedata[256]; + std::ifstream in (argv[1], std::ios:: in | std::ios::binary); + if (in) { + in .seekg(0, std::ios::end); + encoded.resize( in .tellg()); in .seekg(0, std::ios::beg); in .read( & encoded[0], encoded.size()); in .close(); + } + int outlength; + char * cres = curl_easy_unescape(curl, encoded.c_str(), encoded.length(), & outlength); + std::string res(cres, cres + outlength); + curl_free(cres); + curl_easy_cleanup(curl); + std::ofstream myfile2; + myfile2.open(argv[2]); + myfile2 << res; + myfile2.close(); + return 0; +}