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

用C socket http发送这段请求报文

HTTP分为请求行,请求头部以及请求内容
那个长度数字值就是请求内容的长度(字节为单位)
给一段例子你就基本明白了:
onst CString getString(int i)
{
    CString s;
    s.Format(_T("%d"), i);
    return s;
}
////////////////////////////////
CString cnt;
        CString psr;
        cnt.Append(_T("<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"));
        cnt.Append(_T("<soap12:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-
instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:soap12=\"http://www.w3.org/2003/05/soap-envelope\">\r\n"));
        cnt.Append(_T("<soap12:Body>\r\n"));
        cnt.Append(_T("<CelsiusToFahrenheit xmlns=\"http://tempuri.org/\">\r\n"));
        cnt.Append(_T("<Celsius>100</Celsius>\r\n"));
        cnt.Append(_T("</CelsiusToFahrenheit>\r\n"));
        cnt.Append(_T("</soap12:Body>\r\n"));
        cnt.Append(_T("</soap12:Envelope>\r\n\r\n"));
        psr.Append(_T("POST "));
        psr.Append(_T("/webservices/tempconvert.asmx"));
        psr.Append(_T(" HTTP/1.1\r\nHOST: "));
        psr.Append(_T("www.w3schools.com"));
        psr.Append(_T("\r\nContent-Type: application/soap+xml; charset=utf-8"));
     &nb


相关文档:

keil C 从零学起 教训1

#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar num;
void main()
{
 TMOD=0x01;
 TH0=(65536-45872)/256;
 TL0=(65536-45872)%256;
 EA=1;
 ET0=1;
 TR0=1;
 P1=0xFF;
 while(1);
}
void T0_time() interrupt 1
{
  ......

hexdump s 0 n 52 C实例 helloworld

[root@localhost test]# hexdump -s 0 -n 52 -C helloworld
00000000  7f 45 4c 46 01 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  02 00 03 00 01 00 00 00  10 83 04 08 34 00 00 00  |............4...|
00000020  30 08 00 00 00 00 00 00  34 00 20 ......

我的C实践(7):位计数

  位计数就是对一个数中具有某些特征的位进行计数。看下面实现:
/* bitscount.c:位计数 */
/* 计算x中1位的数目:方案1,采用分治策略 */
inline int pop(unsigned x){
/* 对每个2位字段,先析出其右端的1位,再析出其左端的1位,然后让这两个位相加 */
x=(x & 0x55555555)+((x>>1) & 0x555555 ......

我的C实践(8):字搜索

  字搜索就搜索一个数中具有某些特征的位。实现如下:
/* wsearch.c:字搜索 */
/* 从左边寻找第一个0字节:第0(1,2,3)个字节是0时,返回0(1,2,3),否则返回4 */
int zbytel(unsigned x){
if((x>>24)==0) return 0;
else if((x & 0x00ff0000)==0) return 1;
else if((x & 0x0000ff00)==0) r ......

【转】c代码优化


1、选择合适的算法和数据结构
选择一种合适的数据结构很重要,如果在一堆随机存放的数中使用了大量的插入和删除指令,那使用链表要快得多。数组与指针语句具有十分密切的关系,一般来说,指针比较灵活简洁,而数组则比较直观,容易理解。对于大部分的编译器,使用指针比使用数组生成的代码更短,执行效率更高。
在许多 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号