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

📄 inchat.c

📁 在linux下的聊天软件
💻 C
字号:
/*
  inchat.c
  
  SSI for Free Chat which simply spits out how many people are in
  chat right now.
  
  by Bill Kendrick, ported to NT by Patrick Stepp
  kendrick@zippy.sonoma.edu, stepp@adelphia.net
  http://zippy.sonoma.edu/kendrick/
  
  June 3, 1997 - June 3, 1997
  */


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "readline.h"
#include "myopen.h"


int main(int argc, char * argv[])
{
  FILE * fi;
  char temp[1024], file[1024];
  int in, z, simple;
  
  
  strcpy(file, "C:/chat/who.dat");
  
  simple = 0;
  
  if (argc == 2 || argc == 3)
    {
      z = 1;
      
      if (argv[1][0] != '-')
	{
	  strcpy(file, argv[1]);
	  
	  z = 2;
	}
      
      if (argc > z && strcmp(argv[z], "-simple") == 0)
	simple = 1;
    }
  
  in = 0;
  
  fi = myopen(file, "r");
  
  if (fi != NULL)
    {
      do
	{
	  readline(fi, temp);
	  if (!feof(fi))
	    {
	      in++;
	      readline(fi, temp);
	      readline(fi, temp);
	      readline(fi, temp);
	      readline(fi, temp);
	    }
	}
      while (!feof(fi));
    }
  
  if (simple == 0)
    {
      printf("There ");
      
      if (in == 0)
	printf("are no people");
      else if (in == 1)
	printf("is one person");
      else
	printf("%d people", in);
      
      printf(" in chat.");
    }
  else
    printf("%d", in);
}

⌨️ 快捷键说明

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