易截截图软件、单文件、免安装、纯绿色、仅160KB

跨平台 C URL 编解码


char dec2hexChar(short int n) {
 if ( 0 <= n && n <= 9 ) {
  return char( short('0') + n );
 } else if ( 10 <= n && n <= 15 ) {
  return char( short('A') + n - 10 );
 } else {
  return char(0);
 }
}
short int hexChar2dec(char c) {
 if ( '0'<=c && c<='9' ) {
  return short(c-'0');
 } else if ( 'a'<=c && c<='f' ) {
  return ( short(c-'a') + 10 );
 } else if ( 'A'<=c && c<='F' ) {
  return ( short(c-'A') + 10 );
 } else {
  return -1;
 }
}
string escapeURL(const string &URL)
{
 string result = "";
 for ( unsigned int i=0; i<URL.size(); i++ ) {
  char c = URL[i];
  if (
   ( '0'<=c && c<='9' ) ||
   ( 'a'<=c && c<='z' ) ||
   ( 'A'<=c && c<='Z' ) ||
   c=='/' || c=='.'
   ) {
   result += c;
  } else {
   int j = (short int)c;
   if ( j < 0 ) {
    j += 256;
   }
   int i1, i0;
   i1 = j / 16;
   i0 = j - i1*16;
   result += '%';
   result += dec2hexChar(i1);
   result += dec2hexChar(i0);
  }
 }
 return result;
}
std::string deescapeURL(const std::string &URL) {
 string result = "";
 for ( unsigned int i=0; i<URL.size(); i++ ) {
  char c = URL[i];
  if ( c != '%' ) {
   result += c;
  } else {
   char c1 = URL[++i];
   char c0 = URL[++i];
   int num = 0;
   num += hexChar2dec(c1) * 16 + hexChar2dec(c0);
   result += char(num);
  


相关文档:

Delphi 与 C/C++ 数据类型对照表

Delphi 与 C/C++ 数据类型对照表
Delphi数据类型C/C++
ShorInt
8位有符号整数
char
Byte
8位无符号整数
BYTE,unsigned short
SmallInt
16位有符号整数
short
Word
16位无符号整数
unsigned short
Integer,LongInt
32位有符号整数
int,long
Cardinal,LongWord/DWORD
32位无符号整数
unsigned long
Int6 ......

基于S3C2440的Linux内核移植和yaffs2文件系统制作

  基于S3C2440的Linux内核移植和yaffs2文件系统制作 收藏
Linux内核移植和根文件系统制作
第一章 移植内核... 2
1.1 Linux内核基础知识... 2
1.1.1  Linux版本... 2
1.1.2 什么是标准内核... 2
1.1.3 Linux操作系统的分类... 3
1.1.4 linux内核的选择... 4
1.2 Linux内核启动过程概述... 5
1.2.1  ......

简述C和C++程序员学习历程

哈哈!有幸在某网站发现这篇文章,读罢,觉得蛮有道理,发来大家一起共勉之   
总是被同学们问到,如何学习C和C++才不茫然,才不是乱学,想了一下,这里给出一个总的回复。
  一家之言,欢迎拍砖哈。
  1、可以考虑先学习C.
  大多数时候,我们学习语言的目的,不是为了成为一个语言专家,而是希望 ......

c/C++内存分配—new,malloc,GlobalAlloc详解

                    
                    C++内存分配秘籍—new,malloc,GlobalAlloc详解
  ......

static C C++语义

存储期storage duration(extent), 指为对象配置的内存的存活期,比如local extent
生存空间scope,指对象在程序内的存活区域,即可被访问的范围,比如file scope, static scope, local scope
C
local static object
 函数内部的object,具有local scope,但是每次函数被调用后该对象的内存不清理,到下次调用还保 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号