📄 chatwrite.c
字号:
/* chatwrite.c For Free Chat By Bill Kendrick kendrick@zippy.sonoma.edu http://zippy.sonoma.edu/kendrick/ September 29, 1996 - October 3, 1996 / January 13, 1997 / June 10, 1997*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "readline.h"#include "chatwrite.h"#include "copyback.h"#include "defines.h"#include "myopen.h"void chatwrite(char * time, char * name, char * text){ char temp[STRLEN]; int i, j; FILE * fi, * fo; if (LOG == YES || (LOG == SMALL && strcmp(name, "JOIN") == 0)) { fo = myopen("chat.logs", "a"); if (fo == NULL) { printf("System is down! (can't append to \"chat.logs\")\n"); exit(0); } fprintf(fo, "%s\t", time); fprintf(fo, "%s\t", name); fprintf(fo, "%s\n", text); fclose(fo); } fo = myopen("chat.tmp", "w"); if (fo == NULL) { printf("System is down! (can't create \"chat.tmp\")\n"); exit(0); } fprintf(fo, "%s\n", time); fprintf(fo, "%s\n", name); fprintf(fo, "%s\n", text); fi = myopen("chat.dat", "r"); if (fi == NULL) { printf("System is down! (can't read \"chat.dat\")\n"); exit(0); } for (i = 0; i < MAXLINES; i++) { for (j = 0; j < 3; j++) { readline(fi, temp); if (!feof(fi)) fprintf(fo, "%s\n", temp); else i = MAXLINES; } } fclose(fi); fclose(fo); copyback("chat.dat", "chat.tmp");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -