wfile.bak

来自「采用PC104实现多串口通信,同时显示数据.此程序可以直接使用.」· BAK 代码 · 共 32 行

BAK
32
字号
#include<stdio.h>
main()
 {
 int i,i1;
 char ch,ch1;
 float f,f1;
 FILE * fp;
 printf("\nInput ch i f:");
 scanf("%c%d%f",&ch,&i,&f);


 if((fp=fopen("dform.dat","w"))==NULL)
	{
	 printf("Can not open the file\n");
	 exit(0);

	}

 fprintf(fp,"%c%5d%4.1f",ch,i,f);
 fclose(fp);

 if((fp=fopen("dform.dat","r"))==NULL)
	{
	 printf("Can not open the file\n");
	 exit(0);

	}
 fscanf(fp,"%c%d%f",&ch1,&i1,&f1);
 printf("%c%5d%4.1f",ch1,i1,f1);
 fclose(fp);

 }

⌨️ 快捷键说明

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