CodeBus
www.codebus.net
Search
Sign in
Sign up
Hot Search :
Source
embeded
web
remote control
p2p
game
More...
Location :
Home
Search - buf.h
Main Category
SourceCode
Documents
Books
WEB Code
Develop Tools
Other resource
Search - buf.h - List
[
Crack Hack
]
base64src
DL : 0
C++ Base64编码/解码源代码 inline int Base64Encode(char * base64code, const char * src, int src_len = 0) inline int Base64Decode(char * buf, const char * base64code, int src_len = 0) 以上两个函数内联定义在base64.h中,使用时include \"base64.h\" 即可,编码后的长度一般比原文多占1/3的存储空间,为了效率,程序并没有检查目标存储区是否溢出,请保证有足够的存储空间。 -C Base64 encoding / decoding source code inline int Base64Encode (char * base64code, const char * src, int src_len = 0) inline int Base64Decode (char * buf, base64code const char *, int src_len = 0) over two letters few within the definition in conjunction base64.h, when used include "base64.h" can, coding the original length generally occupy more than 1 / 3 of storage space, in order to efficiency, procedures and did not check whether the target storage areas overflow, please ensure that there is sufficient storage space.
Update
: 2008-10-13
Size
: 5.45kb
Publisher
:
王晓名
[
OS Develop
]
shellc
DL : 0
一个完整的SHELL实现源代码,内容包括:buf.c def.h dir.c file.c fs.c fs.h dh.c inode.c main.c os.exe panic.c 对学习操作系统有很大的帮助
Update
: 2008-10-13
Size
: 54.04kb
Publisher
:
鹳达
[
SCM
]
红外接收
DL : 0
430红外接收 #include #include #include #include #include "xtype.h" #define IRDA (uint8)0x01 //P1_0 uint8 ifg; uint8 index=0,value; uint8 bitValue; uint8 flag; uint8 Buf[128],i; void main( void ) { WDTCTL = WDTPW + WDTHOLD;// Stop WDT BCSCTL1&=~XT2OFF; //XT2 available BCSCTL2|=SELM1; //Mclk,SMCLK=8M BCSCTL2|=SELS;
Update
: 2009-09-17
Size
: 979byte
Publisher
:
coco123
[
Internet-Network
]
一个判断远程主机存活程序代码
DL : 0
一个判断远程主机存活程序代码(ping) #include #include #include #include #include "winsock.h" #pragma comment(lib,"Ws2_32"); #define SEND_SIZE 32 #define PACKET_SIZE 4096 #define ICMP_ECHO 8 #define ICMP_ECHOREPLY 0 struct icmp { unsigned char icmp_type; unsigned char icmp_code; unsigned short icmp_cksum; unsigned short icmp_id; unsigned short icmp_seq; unsigned long icmp_data; }; struct ip { unsigned char ip_hl:4; unsigned char ip_v:4; unsigned char ip_tos; unsigned short ip_len; unsigned short ip_id; unsigned short ip_off; unsigned char ip_ttl; unsigned char ip_p; unsigned short ip_sum; unsigned long ip_src; unsigned long ip_dst; }; unsigned char sendpacket[PACKET_SIZE]; unsigned char recvpacket[PACKET_SIZE]; struct sockaddr_in dest_addr; struct sockaddr_in from_addr; int sockfd; int pid; unsigned short cal_chksum(unsigned short *addr,int len); int pack(int pack_no); int unpack(unsigned char *buf,int len); void send_packet(void); void recv_packet(void); void main(int argc,char *argv[]) { struct hostent *host; struct protoent *protocol; WSADATA wsaData; int timeout=1000; int SEND_COUNT=4; int i; char *par_host; par_host=argv[argc-1]; //IP赋值 switch(argc) { case 2: break; case 3: if(strcmp(argv[1],"-t")==0) { SEND_COUNT=10000; break; } //fall through default: printf("usage: %s [-t] Host name or IP address\n",argv[0]); exit(1); } if(WSAStartup(0x1010,&wsaData)!=0) { printf("wsastartup error\n"); exit(1); } if( (protocol=getprotobyname("icmp") )==NULL) { printf("getprotobyname error\n"); exit(1); } /* printf("%s\n",protocol->p_name); printf("%s\n",protocol->p_aliases); printf("%d\n",protocol->p_proto); system("pause"); */ if( (sockfd=socket(AF_INET,SOCK_RAW,protocol->p_proto) )<0) { printf("socket error\n"); exit(1); } if(setsockopt(sockfd,SOL_SOCKET,SO_RCVTIMEO,(char*)&timeout,sizeof(timeout))h_length); //resolve address to hostname if(host=gethostbyaddr(host->h_addr,4,PF_INET)) par_host=host->h_name; // //printf("%s\n",par_host); // } else if( dest_addr.sin_addr.s_addr=inet_addr(par_host)==INADDR_NONE) { printf("Unkown host %s\n",par_host); exit(1); } pid=getpid(); /* printf("%d\n",pid); system("pause"); */ printf("Pinging %s [%s]: with %d bytes of data:\n\n",par_host,inet_ntoa(dest_addr.sin_addr),SEND_SIZE); for(i=0;i1) { sum+=*w++; nleft-=2; } if( nleft==1) { *(unsigned char *)(&answer)=*(unsigned char *)w; sum+=answer; } sum=(sum>>16)+(sum&0xffff); sum+=(sum>>16); answer=~sum; return answer; } //打包 int pack(int pack_no) { int packsize; struct icmp *icmp; packsize=8+SEND_SIZE; icmp=(struct icmp*)sendpacket; icmp->icmp_type=ICMP_ECHO; icmp->icmp_code=0; icmp->icmp_cksum=0; icmp->icmp_seq=pack_no; icmp->icmp_id=pid; icmp->icmp_data=GetTickCount(); icmp->icmp_cksum=cal_chksum( (unsigned short *)icmp,packsize); /*校验算法*/ return packsize; } //解包 int unpack(unsigned char *buf,int len) { struct ip *ip; struct icmp *icmp; double rtt; int iphdrlen; ip=(struct ip *)buf; iphdrlen=ip->ip_hl*4; icmp=(struct icmp *)(buf+iphdrlen); if( (icmp->icmp_type==ICMP_ECHOREPLY) && (icmp->icmp_id==pid) ) { len=len-iphdrlen-8; rtt=GetTickCount()-icmp->icmp_data; printf("Reply from %s: bytes=%d time=%.0fms TTL=%d icmp_seq=%u\n", inet_ntoa(from_addr.sin_addr), len, rtt, ip->ip_ttl, icmp->icmp_seq); return 1; } return 0; } //发送 void send_packet() { int packetsize; static int pack_no=0; packetsize=pack(pack_no++); if( sendto(sockfd,(char *)sendpacket,packetsize,0,(struct sockaddr *)&dest_addr,sizeof(dest_addr) )=0) success=unpack(recvpacket,n); else if (WSAGetLastError() == WSAETIMEDOUT) { printf("Request timed out.\n"); return; } }while(!success); } UID5380 帖子239 精华0 积分1289 阅读权限40 来自软件学院 在线时间81 小时 注册时间2006-5-22 最后登录2007-2-24 查看详细资料 TOP
Update
: 2009-05-29
Size
: 5.74kb
Publisher
:
shuiyuan313
[
Crack Hack
]
base64src
DL : 0
C++ Base64编码/解码源代码 inline int Base64Encode(char * base64code, const char * src, int src_len = 0) inline int Base64Decode(char * buf, const char * base64code, int src_len = 0) 以上两个函数内联定义在base64.h中,使用时include "base64.h" 即可,编码后的长度一般比原文多占1/3的存储空间,为了效率,程序并没有检查目标存储区是否溢出,请保证有足够的存储空间。 -C Base64 encoding/decoding source code inline int Base64Encode (char* base64code, const char* src, int src_len = 0) inline int Base64Decode (char* buf, base64code const char*, int src_len = 0) over two letters few within the definition in conjunction base64.h, when used include "base64.h" can, coding the original length generally occupy more than 1/3 of storage space, in order to efficiency, procedures and did not check whether the target storage areas overflow, please ensure that there is sufficient storage space.
Update
: 2025-03-14
Size
: 5kb
Publisher
:
王晓名
[
DSP program
]
bsl
DL : 0
SEED的VPM642测试程序-板级支持库-SEED
Update
: 2025-03-14
Size
: 665kb
Publisher
:
liyufeng
[
OS Develop
]
shellc
DL : 0
一个完整的SHELL实现源代码,内容包括:buf.c def.h dir.c file.c fs.c fs.h dh.c inode.c main.c os.exe panic.c 对学习操作系统有很大的帮助-SHELL realize a complete source code, including: buf.c def.h dir.c file.c fs.c fs.h dh.c inode.c main.c os.exe panic.c learning the operating system has a help
Update
: 2025-03-14
Size
: 54kb
Publisher
:
鹳达
[
Windows Develop
]
TestKfifo
DL : 0
Kfifo源于Linux下的C源码,经封装成C++的CKfifo类 源文件:Kfifo.h 和 Kfifo.cpp 功能:具有互斥功能的BUF队列类。 编译环境: Visual Studio2008-Kfifo from the C source code under Linux, after packaging into a C++, CKfifo class source file: Kfifo.h and Kfifo.cpp functions: BUF queue with mutually exclusive features classes. Compiler Environment: Visual Studio2008
Update
: 2025-03-14
Size
: 78kb
Publisher
:
TYH
[
Other Embeded program
]
jiaoduzhuanganqi
DL : 0
角度转感器的基本控制方法!部分代码如下: #include"lcd1602.h" #include"delay.h" #include"adxl345.h" void main() { uchar devid delay(500) //上电延时 init() //初始化 DisplayOneChar(0,0, A ) DisplayOneChar(1,0, : ) Init_ADXL345() //初始化ADXL345 devid=Single_Read_ADXL345(0X00) //读出的数据为0XE5,表示正确 while(1) //循环 { Multiple_read_ADXL345() //连续读出数据,存储在BUF中 display_x() //---------显示X轴 display_y() //---------显示Y轴 display_z() //---------显示Z轴 show_o() delay(200) //延时 } }-Turn Angle sensor the basic control method. Part of the HTML code is as follows: #include"lcd1602.h" #include"delay.h" #include"adxl345.h" void main() { uchar devid delay(500) //上电延时 init() //初始化 DisplayOneChar(0,0, A ) DisplayOneChar(1,0, : ) Init_ADXL345() //初始化ADXL345 devid=Single_Read_ADXL345(0X00) //读出的数据为0XE5,表示正确 while(1) //循环 { Multiple_read_ADXL345() //连续读出数据,存储在BUF中 display_x() //---------显示X轴 display_y() //---------显示Y轴 display_z() //---------显示Z轴 show_o() delay(200) //延时 } }
Update
: 2025-03-14
Size
: 55kb
Publisher
:
韦武
[
DSP program
]
support
DL : 0
#include <string.h> #include <stdio.h> /* ======================================================================== */ /* MEM_COMPARE -- Compare two memory images and output a detailed dump if */ /* the images differ. */ /* ======================================================================== */ int mem_compare(const void *r1, const char *n1, const void *r2, const char *n2, int len) { unsigned char *c1, *c2 int i, j, k, total, skip unsigned addr char buf[80] const char hex[16] = "0123456789ABCDEF" DSP边缘处理-#include <string.h> #include <stdio.h> /* ========================================================================*/ /* MEM_COMPARE-- Compare two memory images and output a detailed dump if */ /* the images differ. */ /* ========================================================================*/ int mem_compare(const void*r1, const char*n1, const void*r2, const char*n2, int len) { unsigned char*c1,*c2 int i, j, k, total, skip unsigned addr char buf[80] const char hex[16] = "0123456789ABCDEF"
Update
: 2025-03-14
Size
: 2kb
Publisher
:
张志强
[
Software Engineering
]
111
DL : 0
1 .手机屏幕尺寸为 w = 240 h = 320,现提供LCD BUF(type:unsigned short)的起始地址为lcdbuff。要求从坐标(100,10)处开始绘制一条长度为300的黑色(颜色值为0)垂直线。 参考代码: 2 .在第1题的基础上封装一个画垂直线的函数,不考虑颜色。 参考代码: 3 .在第1题的基础上封装一个画水平线的函数,颜色可不考虑。 参考代码: -The start address of a mobile phone screen size w = 240 h = 320, and now the LCD BUF (type: unsigned short) lcdbuff. Required to start drawing from the coordinates (100,10) at a length of 300 black (color = 0) vertical line. The reference code: 2 encapsulated in the question 1 on the basis of a painting a function of the vertical line, without regard to color. Reference code: package in question 1 on the basis of a painting of a function of the horizon, time to consider color. Reference code:
Update
: 2025-03-14
Size
: 3kb
Publisher
:
GXT
[
Internet-Network
]
3_read
DL : 0
#include shm.h int main(int argc,char *argv[]) { key_t key int shm_id char *buf //鑾峰緱key if((key = ftok( ./ ,0xa)) < 0){ perror( ftok ) exit(1) } //鑾峰緱鍏变韩鍐呭瓨 if((shm_id = shmget(key,SHM_SIZE,IPC_CREAT|0644)) < 0){ perror( shmget ) exit(1) } //寤虹珛鍏变韩鍐呭瓨鍒拌
Update
: 2025-03-14
Size
: 1kb
Publisher
:
qwedenglb
CodeBus
is one of the largest source code repositories on the Internet!
Contact us :
1999-2046
CodeBus
All Rights Reserved.