writes.c

来自「linux 软件工程师C语言版,经典linuxC语言编程,诸多案例」· C语言 代码 · 共 20 行

C
20
字号
#include<stdio.h>
#include"phbook.h"
void writes()
{
     int n;
     printf("How many do you want to insert(0<m<11):");
     scanf("%d",&m);
     for(n=0;n<m;n++)
     {
        printf("Insert the Name:");
        scanf("%s",&s[n].name);
        printf("Insert the No:");
        scanf("%s",&s[n].No);
      }
     fp = fopen("file1","a+");
     fwrite(s,sizeof(struct test),m,fp);
     fclose(fp);
     printf("Add successfully!\n");
     face();
}

⌨️ 快捷键说明

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