⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 str.c

📁 LINUX下开发的FTP服务器,基本实现FTP的功能.实现PORT的模式.
💻 C
字号:
#include <stdio.h>
#include "str.h"


void apart_comm_valus(char *buffer,char *comm,char *val)
{
	memset(comm,0,50);
	memset(val,0,50);
	int i=0;
	int count=1;
	char *tmp=NULL;
	char *tmp1=NULL;
	char *tmp_loop=NULL;
	tmp=find_first_of(buffer,' ');
	if (tmp==NULL)
	{
		tmp=find_first_of(buffer,'\r');
		for (i=0;i<tmp-buffer ;i++ )
		{
			*(comm+i)=*(buffer+i);
		}
		return;
	}
	for (i=0;i<tmp-buffer ;i++ )
	{
		*(comm+i)=*(buffer+i);
	}
	do
	{
		tmp_loop=find_first_of(tmp+count,' ');
		if (tmp_loop == NULL)
		{
			break;
		}
		else
		{
			count++;
		}
	}
	while (1);
	tmp1=find_first_of(tmp+count,'\r');
	for (i=0;i<tmp1-tmp-count ;i++ )
	{
		*(val+i)=*(tmp+count+i);
	}
}
char *find_first_of(char *str,char ch)
{
	int i=0;
	int len=strlen(str);
	if(len)
	{
		for(i=0;i<len;i++)
		{
			if(*(str+i) == ch)
			{
				return str+i;
			}
		}
	}
	return NULL;

}
int copy_str(char *source_str,char *aim_str,int num,int start_space)
{
	int i=0;
	if(source_str == aim_str)
	{
		return 0;
	}
	else
	{
		for(i=0;i<num;i++)
		{
			*(aim_str+i) = *(source_str+start_space+i);
			if(*(source_str+start_space+i) == '\0')
			{
				return i;
			}
			
		}
		*(aim_str+i) = '\0';
		return  i;
	}
	
}
int replace_of(char *str,char formerly_ch,char substitute_ch)
{
	int i=0;
	int change_count=0;
	int len=strlen(str);
	for (i=0;i<len ;i++ )
	{
		if (*(str+i) == formerly_ch)
		{
			*(str+i) = substitute_ch;
			change_count++;
		}
	}
	return change_count;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -