Linux下C语言实现字符串子串替换
	
    
    
	
    由于LINUX 
C没有对字符串子串替换功能,所以我自己写了一个str_replace函数,实现了字符串替换.
请大家参考.
/*
 * FUNCTION     : str_replace
 *
 ABSTRACT     : replace child string in a string.
 *
 PARAMETER    :
 *      
 char* str           
the string that be replace
 *      
 char* str_src       source string
 *      
 char* str_des       destination string
 *
 RETURN       :
 *      
 0       OK
 *     
 -1       FALSE
 * CREATE       : 2006-01-05   
 ZHANG.JINCUN
 * NOTE        
 :
 */
int str_replace(char* str,char* str_src, char* 
str_des){
    char *ptr=NULL;
    
char buff[256];
    char buff2[256];
   
 int i = 0;
    
    if(str != 
NULL){
        strcpy(buff2, str);
   
 }else{
        
printf("str_replace err!\n");
       
 return -1;
    }
    memset(buff, 
0x00, sizeof(buff));
    while((ptr = strstr( buff2, 
str_src)) !=0){
        
if(ptr-buff2 != 0) memcpy(&buff[i], buff2, ptr - buff2);
       
 memcpy(&buff[i + ptr - buff2], str_des, strlen(str_des));
       
 i += ptr - bu
    
     
	
	
    
    
	相关文档:
        
    
    总览
用iptables -ADC 来指定链的规
则
,-A添加 -D删除 -C 修改
iptables - [RI] chain rule num rule-specification[option]
用iptables - RI 通过规则的顺序指定
iptables -D chain rule num[option]
删除指定规则
iptables -[LFZ] [chain][option]
用iptables -LFZ 链名 [选项]
iptables -[NX] chain
用 -NX ......
	
    
        
    
    
由于 Linux 良好的用户权限管理体系,病毒往往是 Linux 系统管理员最后才需要考虑的问题。以往,Linux 上的杀毒软件主要是为企业的邮件和文件服务器所设计的。如今,随着 Linux 桌面用户数量的增长,桌面用户在受益于 Linux 系统对病毒较强的天然免疫力的同时,也需要杀毒软件清理从网络或U盘带来的WIndows病毒。尽管那些 ......
	
    
        
    
    
3.2.1 Linux 内存绑定在局部存储器的实现总体步骤
总体步骤:
l         采用方案三,在在原来分析的基础上,以及已知Linux系统内存的初始化的情况,对内核代码进行修改,主要包括确定新区的范围,建立新区,重新对分配内存的分配机制进行设置。
l    &n ......
	
    
        
    
    1. 相关函数                                                & ......
	
    
        
    
    Curl是Linux下一个很强大的http命令行工具,其功能十分强大。
1) 读取网页
$ curl http://www.linuxidc.com
2) 保存网页
$ curl http://www.linuxidc.com > page.html
$ curl -o page.html http://www.linuxidc.com
3) 使用的proxy服务器及其端口: -x
$ curl -x 123.45.67.89:1080 -o page.html http://www.linu ......