資源簡介
這是一個可以實現常用功能的聊天工具,是基于linux平臺設計的,包含源代碼及Makefile文件,可直接運行看效果.相關說明可以見本人博客http://blog.csdn.net/wh15271915053
代碼片段和文件信息
#include?“check.h“
int?reg_check(struct?message?*recievemsg)
{
int?fd;
int?read_sizewrite_size;
struct?message?cmpmsg;
if(strlen(recievemsg->name)>10?||?strlen(recievemsg->msg)>20?)
{
return?1;
}
???????if(strcmp(recievemsg->name“all“)==0)
{
return?-1;
}
if(strcmp(recievemsg->name“reg“)==0)
{
return?-1;
}
if(strcmp(recievemsg->name“login“)==0)
{
return?-1;
}
if(strcmp(recievemsg->name“trans“)==0)
{
return?-1;
}
if((fd=open(“user.txt“O_RDWR|O_CREAT|O_APPEND0666))<0)
{
perror(“open“);
printf(“open\n“);
return?-2;
}
do
{
if((read_size=read(fd&cmpmsgsizeof(cmpmsg)))?0)
{
perror(“read“);
close(fd);
return?-2;
}
if(read_size?!=?sizeof(struct?message)?&&?read_size?!=0)
{
close(
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????I.A...R??????1161??2014-03-20?10:44??communication_tools\chatlog.txt
????I.A....??????2216??2014-03-18?09:56??communication_tools\check.c
????I.A....???????422??2014-03-18?09:56??communication_tools\check.h
????I.A....??????2408??2014-03-18?09:58??communication_tools\check.o
????I.A....?????13622??2014-03-18?10:00??communication_tools\client
????I.A....??????9950??2014-03-18?09:56??communication_tools\client.c
????I.A....??????6553??2014-03-18?16:26??communication_tools\display
????I.A....??????1081??2014-03-18?09:56??communication_tools\display.c
????I.A....?????12671??2014-03-18?09:58??communication_tools\hello
????I.A....??????1229??2014-03-18?09:56??communication_tools\li
????I.A....???????594??2014-03-18?09:56??communication_tools\li
????I.A....??????1404??2014-03-18?09:58??communication_tools\li
????I.A....???????244??2014-03-18?09:56??communication_tools\Makefile
????I.A....??????6529??2014-03-18?09:56??communication_tools\server.c
????I.A....??????5788??2014-03-18?09:58??communication_tools\server.o
????I.A....??????6336??2014-03-18?19:37??communication_tools\user.txt
?????目錄??????????0??2014-03-20?10:46??communication_tools
-----------?---------??----------?-----??----
????????????????72208????????????????????17
- 上一篇:上市公司財務報表合并
- 下一篇:網上購物系統設計與實現.doc
評論
共有 條評論