当前位置:网站首页>[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);
}
}边栏推荐
- 招标公告:深圳市财政局数据库异地灾备项目
- 药品管理系统加数据库,一夜做完,加报告
- Raft介绍
- 附加:(还没写,别看~~~)CorsFilter过滤器;
- register_ Chrdev and CDEV_ init cdev_ Add usage differences
- RT thread heap size Setting
- 【Verilog基础】十进制负数的八进制、十六进制表示
- Hundreds of lines of code to implement a JSON parser
- 备战数学建模36-时间序列模型2
- After 15 years of working on 21 types of hardware, where is Google?
猜你喜欢

Tutoriel etcd - chapitre 8 API compacte, Watch et lease pour etcd

Implementation of aut, a self-developed transport layer protocol for sound network -- dev for dev column

备战数学建模33-灰色预测模型2

MC Instruction Decoder

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

Niuke: how many different binary search trees are there

Restartprocessifvisible process

容联云首发基于统信UOS的Rphone,打造国产化联络中心新生态
Mysql8 error: error 1410 (42000): you are not allowed to create a user with grant solution
![[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)](/img/54/fd7541dae4aad7e4216bcaabbb146b.png)
[Verilog basics] summary of some concepts about clock signals (clock setup/hold, clock tree, clock skew, clock latency, clock transition..)
随机推荐
深度学习——(2)几种常见的损失函数
附加:(还没写,别看~~~)CorsFilter过滤器;
招标公告:深圳市财政局数据库异地灾备项目
POJ Project Summer
Bidding announcement: Taizhou Unicom Oracle all in one machine and database maintenance service project in 2022
The 25th anniversary of Hong Kong's return to China the Hong Kong Palace Museum officially opened as a new cultural landmark
halcon知识:矩阵专题【02】
IndexSearch
搬运两个负载均衡的笔记,日后省的找
2020 Blue Bridge Cup group B - move bricks - (greedy sorting +01 backpack)
MC Instruction Decoder
In order to make remote work unaffected, I wrote an internal chat room | community essay
Bidding announcement: Tianjin housing provident fund management center database all-in-one machine and database software project (budget: 6.45 million)
2022新消费半年盘点:行业遇冷,但这九个赛道依然吸金
The new tea drinks are "dead and alive", but the suppliers are "full of pots and bowls"?
Asp. NETCORE uses cache and AOP to prevent repeated commit
【牛客网刷题系列 之 Verilog快速入门】~ 位拆分与运算
I 用c I 实现“栈”
STL教程7-set、pair对组和仿函数
2022蓝桥杯国赛B组-2022-(01背包求方案数)