crtstatm.c

来自「unix下进行电报传输的源码。采用信号灯技术避免文件冲突等等」· C语言 代码 · 共 29 行

C
29
字号
#include <stdio.h>
#include "nfcnet.h"
void main(void)
{ int i,j;
  FILE *fp;
  char c_key[10];
  c_key[0]=0;
  printf("\n\nBe carefull to run this program, because it\n");
  printf("destroy the data in file stat_obj.txt .\n\n");
  while(strlen(c_key)==0||
          c_key[0]!='Y'&&
          c_key[0]!='y'&&
          c_key[0]!='N'&&
          c_key[0]!='n')
  { printf("Are you sure to run this program(Y/N) [s] ");
    gets(c_key); }
  if(c_key[0]=='N'||c_key[0]=='n')exit(0);
  if((fp=fopen("stat_obj.txt","w+"))==NULL)
  { printf("The stat_obj.txt is not opened !\n");
    exit(1);}
  for(i=0;i<P_STTNUMB;i++)
  { fprintf(fp,"00000");
    for(j=0;j<P_SENDOBJ;j++)fprintf(fp,"N");
    fprintf(fp,"\n");
  }
  fclose(fp);
  printf("The stat_obj.txt is created !\n");
}

⌨️ 快捷键说明

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