当前位置:网站首页>[Demo] 循环写文件
[Demo] 循环写文件
2022-06-30 15:48:00 【ykun089】
超过1G则回头写
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>
struct timespec interval = {0,10};
char *a = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
char *c = "qwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiopqwertyuiop";
int main(int argc,char** agrv)
{
long offset = 0;
constexpr long oneGB = 1024*1024*1024;
FILE* f = fopen("./loopwrite_test","wb+");
while(1){
offset = ftell(f);
if(offset>=oneGB){
rewind(f);
a = c;
}
fwrite(a,100,1,f);
fflush(f);
//nanosleep(&interval,NULL);
}
}边栏推荐
- 9:第三章:电商工程分析:4:【通用模块】;(待写……)
- Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan
- BC1.2 PD协议
- restartProcessIfVisible的流程
- 2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
- Two methods for MySQL to open remote connection permission
- 【Verilog基础】十进制负数的八进制、十六进制表示
- STL教程7-set、pair对组和仿函数
- Etcd教程 — 第八章 Etcd之Compact、Watch和Lease API
- 详解Go语言中for循环,break和continue的使用
猜你喜欢

安全帽佩戴检测算法研究

On July 2, I invited you to TD Hero online conference

Build cloud native observability capability suitable for organizations

利用PIL进行不失真的resize

Li Zexiang, a legendary Chinese professor, is making unicorns in batches

腾讯二面:@Bean 与 @Component 用在同一个类上,会怎么样?

Symantec electronic sprint technology innovation board: Tan Jian, the actual controller, is an American who plans to raise 620million yuan

牛客网:有多少个不同的二叉搜索树

牛客网:最小花费爬楼梯

halcon知识:区域专题【07】
随机推荐
IO流_递归
Etcd tutorial - Chapter 8 compact, watch, and lease APIs for etcd
Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column
Li Zexiang, a legendary Chinese professor, is making unicorns in batches
Halcon knowledge: matrix topic [02]
BC1.2 PD协议
POJ Project Summer
go-micro教程 — 第一章 快速入门
Build cloud native observability capability suitable for organizations
RT thread heap size setting
备战数学建模35-时间序列预测模型
深度学习——(2)几种常见的损失函数
Installing jupyter notebook under Anaconda
AVIC UAV technology innovation board is listed: the fist product with a market value of 38.5 billion is pterodactyl UAV
微信表情符号写入判决书,你发的OK、炸弹都可能成为“呈堂证供”
CGR 21 (D,E,F)
Delete duplicates in an ordered array ii[double pointers -- unified in multiple cases]
Mysql8 error: error 1410 (42000): you are not allowed to create a user with grant solution
Cesium-1.72 learning (earth model creation online offline tile)
19:00 p.m. tonight, knowledge empowerment phase 2 live broadcast - control panel interface design of openharmony smart home project