当前位置:网站首页>[demo] write file circularly
[demo] write file circularly
2022-06-30 16:57:00 【ykun089】
exceed 1G Then write back
#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);
}
}
边栏推荐
猜你喜欢
Undistorted resize using pil
Etcd tutorial - Chapter 9 etcd implementation of distributed locks
RT-Thread 堆区大小设置
Mathematical modeling for war preparation 35 time series prediction model
【Verilog基础】关于Clock信号的一些概念总结(clock setup/hold、clock tree、clock skew、clock latency、clock transition..)
Tutoriel etcd - chapitre 8 API compacte, Watch et lease pour etcd
数据挖掘知识点整理(期末复习版)
Halcon knowledge: regional topics [07]
Mathematical modeling for war preparation 34-bp neural network prediction 2
互联网研发效能实践之去哪儿网(Qunar)核心领域DevOps落地实践
随机推荐
[Demo] 循环写文件
【Verilog基础】关于Clock信号的一些概念总结(clock setup/hold、clock tree、clock skew、clock latency、clock transition..)
CMakeLists 基础
【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算
POJ Project Summer
Bc1.2 PD protocol
2022 Blue Bridge Cup group B - expense reimbursement - (linear dp| status DP)
《网络是怎么样连接的》读书笔记 - 汇总篇
安全帽佩戴检测算法研究
Yunhe enmo won the bid for Oracle maintenance project of Tianjin Binhai rural commercial bank in 2022-2023
microblaze 串口学习·2
Go micro tutorial - Chapter 1 getting started
备战数学建模34-BP神经网络预测2
Siyuan notes: can you provide shortcut keys for folding all titles on the page?
药品管理系统加数据库,一夜做完,加报告
[BJDCTF2020]The mystery of ip|[CISCN2019 华东南赛区]Web11|SSTI注入
Deep learning - (2) several common loss functions
聊聊远程办公那些事儿 | 社区征文
IndexSearch
[Verilog basics] octal and hexadecimal representation of decimal negative numbers