- 博客(5)
- 收藏
- 关注
原创 获取串中的参数段,比如你输入一个字符串 set_tcp 127.0.0.1,9999; 这里有三个参数
char _Buffer[512]; string str = gets(_Buffer); string str_ary[20]; string temp_s; int s=0,e=0,i=0,j=0; for(i =0;i { e = find_separator(str,s+j); temp_s.assign(str,s+j,e-s-j); if( !temp_s.empty()){
2008-05-13 12:00:00
378
原创 设置你想要的 分隔符号 比如,;/t 等,这个函数就可以在字符串里边查找分隔符号了
int find_separator(string &str,int start){ bool list_separator[128]; int *p_area = (int *)list_separator; int *p_end = p_area + 32; while(p_area list_separator[0] = true; list_separator[/t] = true
2008-05-13 11:53:00
655
原创 字符串 转 BCD,有四舍五入的功能,参数1 字节数,参数2 小数位数。
void str_to_bcd(char *p_sourse,char *p_dest,int d_len,int dig_len){ unsigned char _buf[20]; unsigned char *p_e = (unsigned char *)p_dest; bool carry = false; int *_s = (int *)_buf; while(_s int i = 0,
2008-05-13 11:49:00
492
原创 int 转 BCD,改造别人的函数而来。
int decm_to_bcd(int s_num){ if(s_num99999999) return -1; unsigned int d_num = 0; int pow = 10000000; short num_c = 0; short shift_c = 28; while(pow > 0){ for(;s_num >= pow;s_num -= pow) num_c+
2008-05-13 11:46:00
726
原创 socket里面的10035
bool tcp_s_lay::receive(char *p_dst, int length) { int temp = 0; int received = 0; int err_c = 0; do{ temp = ::recv(soc_ary[act_soc],p_dst+received,length - received,0); if(temp = SOCKET_ERROR){ i
2008-05-07 17:36:00
1745
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人