diff options
author | Othmar Gsenger <otti@anytun.org> | 2007-12-03 10:51:16 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2007-12-03 10:51:16 +0000 |
commit | fa4f4a8a50c4bab3a3e247fb7186a7f9a00dfc11 (patch) | |
tree | 5ff84c3c71e6d3dadbaf9e13d3fdd84ab2691ca6 /Sockets/tests/base64.cpp | |
parent | added ssl tools (diff) |
Added syncsocket
Diffstat (limited to 'Sockets/tests/base64.cpp')
-rw-r--r-- | Sockets/tests/base64.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Sockets/tests/base64.cpp b/Sockets/tests/base64.cpp new file mode 100644 index 0000000..722439d --- /dev/null +++ b/Sockets/tests/base64.cpp @@ -0,0 +1,34 @@ +#include <stdio.h> + +#include "Base64.h" + + +int main(int argc,char *argv[]) +{ + if (argc < 2) + return -1; + std::string str; + std::string str2; + Base64 b; + if (!strcmp(argv[1],"-file")) + { + if (argc < 3) + return -2; + FILE *fil; + if ((fil = fopen(argv[2],"rt")) != NULL) + { + b.encode(fil, str); + fclose(fil); + } + printf("File:\n%s\n--End of File\n",str.c_str()); + b.decode(str, str2); + printf("Content:\n%s\n--End of Content\n",str2.c_str()); + } + else + { + b.encode(argv[1], strlen(argv[1]), str); + printf("'%s' ==> '%s'",argv[1], str.c_str()); + b.decode(str, str2); + printf(" ==> '%s'\n",str2.c_str()); + } +} |