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

📄 wfile.c

📁 采用PC104实现多串口通信,同时显示数据.此程序可以直接使用.
💻 C
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -