当前位置:网站首页>[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);
}
}边栏推荐
- 删除有序数组中的重复项 II[双指针--多情况统一]
- RT thread heap size setting
- register_ Chrdev and CDEV_ init cdev_ Add usage differences
- [bjdctf2020]the mystery of ip|[ciscn2019 southeast China division]web11|ssti injection
- Build cloud native observability capability suitable for organizations
- Hologres shared cluster helps Taobao subscribe to the extreme refined operation
- 荣盛生物冲刺科创板:拟募资12.5亿 年营收2.6亿
- 备战数学建模34-BP神经网络预测2
- Li Zexiang, a legendary Chinese professor, is making unicorns in batches
- IO流_递归
猜你喜欢

ArcMap operation series: 80 plane to latitude and longitude 84

Headhunter 50, 000, I'll go to VC

居家办公浅谈远程协助快速提效心得 | 社区征文

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

容联云首发基于统信UOS的Rphone,打造国产化联络中心新生态

【机器学习】K-means聚类分析

AVIC UAV technology innovation board is listed: the fist product with a market value of 38.5 billion is pterodactyl UAV

备战数学建模35-时间序列预测模型

MySQL transaction / lock / log summary

There are so many kinds of coupons. First distinguish them clearly and then collect the wool!
随机推荐
CGR 21 (D,E,F)
附加:(还没写,别看~~~)WebMvcConfigurer接口;
招标公告:2022年台州联通Oracle一体机和数据库维保服务项目
go-micro教程 — 第一章 快速入门
The new tea drinks are "dead and alive", but the suppliers are "full of pots and bowls"?
Mathematical modeling for war preparation 33- grey prediction model 2
删除有序数组中的重复项 II[双指针--多情况统一]
居家办公浅谈远程协助快速提效心得 | 社区征文
jspreadsheet/CE JExcel数据字段比给的字段(columns)多会导致空白列的问题解决方案
【Verilog基础】十进制负数的八进制、十六进制表示
[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)
[machine learning] K-means clustering analysis
中国传奇教授李泽湘,正在批量制造独角兽
microblaze 串口学习·2
Explain in detail the use of for loop, break and continue in go language
[Verilog basics] octal and hexadecimal representation of decimal negative numbers
2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
GaussDB创新特性解读:Partial Result Cache,通过缓存中间结果对算子进行加速
Mysql8.0 method and steps for enabling remote connection permission
【微信小程序】小程序的宿主环境