当前位置:网站首页>C language file reading and writing
C language file reading and writing
2022-07-25 20:23:00 【jxb_ eight thousand eight hundred and eighty-eight】
#include <stdio.h>
#include <string.h>
// Structure statement
struct Item
{
char name[24];
float val;
};
void Writefile(Item & a)
{
strcat (a.name,"\0");
char ch;
FILE *fp;// Define the file stream pointer , Used to open a file
fp = fopen("0063120.txt","a");// Write open file
fprintf(fp ,"%s\t%0.2f\n", a.name, a.val);
fclose(fp);// Close file a, If you open it, you have to close it
}
void Readfile()
{
struct Item b;
FILE *fp;// Define the file stream pointer , Used to open a file
fp = fopen("0063120.txt","r");// Write open file
while(!feof(fp))
{
fscanf(fp, "%s\t%f", b.name, &b.val);
if(strlen(b.name) == 0) break;
printf("%s\t%0.2f\n", b.name, b.val);
memset(b.name, 0,sizeof(b.name)) ;
}
fclose(fp);
}
int main()
{
//struct Item a={ " centre post ", 2400}; // Structure definition and assignment
//Writefile(a);
Readfile();
getchar();
return 0;
}
边栏推荐
- 2022.7.24-----leetcode.1184
- Vivo official website app full model UI adaptation scheme
- [today in history] July 18: Intel was founded; The first photo was posted on the world wide web; EBay spins off PayPal
- Kubernetes进阶部分学习笔记
- 网络RTK无人机上机测试[通俗易懂]
- PMP每日一练 | 考试不迷路-7.25
- 参与开源社区还有证书拿?
- Why did I choose to become a network engineer after graduating from weak current for 3 months
- QQ是32位还是64位软件(在哪看电脑是32位还是64位)
- PreScan快速入门到精通第十九讲之PreScan执行器配置、轨迹同步及非配多个轨迹
猜你喜欢

Export and call of onnx file of pytorch model
![Summarize the level of intelligent manufacturing discussion [macro understanding]](/img/84/3addabdf857c562535a4085782d3e8.png)
Summarize the level of intelligent manufacturing discussion [macro understanding]

Google pixel 6A off screen fingerprint scanner has major security vulnerabilities

Cloud native guide: what is cloud native infrastructure

PMP每日一练 | 考试不迷路-7.25
![[noi simulation] string matching (suffix automata Sam, Mo team, block)](/img/db/3ccb00e78bba293acdae91ffa72a2c.png)
[noi simulation] string matching (suffix automata Sam, Mo team, block)

10. < tag dynamic programming and subsequence, subarray> lt.53. maximum subarray and + lt.392. Judge subsequence DBC

JVM(二十三) -- JVM运行时参数

【高等数学】【1】函数、极限、连续

Myormframeworkjdbc review and problem analysis of user-defined persistence layer framework, and thought analysis of user-defined persistence layer framework
随机推荐
[advanced mathematics] [3] Application of differential mean value theorem and derivative
[today in history] June 28: musk was born; Microsoft launched office 365; The inventor of Chua's circuit was born
Introduction and construction of consul Registration Center
When AI encounters life and health, Huawei cloud builds three bridges for them
【云原生 | 从零开始学Kubernetes】八、命名空间资源配额以及标签
Prescan quick start to master Lesson 19: prescan actuator configuration, track synchronization and non configuration of multiple tracks
4. Server startup of source code analysis of Nacos configuration center
wallys//IPQ5018/IPQ6010/PD-60 802.3AT Input Output 10/100/1000M
test
PreScan快速入门到精通第十八讲之PreScan轨迹编辑的特殊功能
How does tiktok break zero?
Jmeter——接口测试
2022.7.24-----leetcode.1184
参与开源社区还有证书拿?
During the interview, I was asked how to remove the weight of MySQL, and who else wouldn't?
Digital informatization (enumerate assumptions first, and then see whether the conditions are met) (1089 werewolf kill - simple version)
9.< tag-动态规划和子序列, 子数组>lt.718. 最长重复子数组 + lt.1143. 最长公共子序列
Successfully solved typeerror: a bytes like object is required, not 'str‘
Application of conductive slip ring in mechanical equipment
CarSim仿真快速入门(十四)—CarSim-Simulink联合仿真