最快的方式来创建大型文件在C + +? [英] Fastest way to create large file in c++?

查看:136
本文介绍了最快的方式来创建大型文件在C + +?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用c ++创建一个平面文本文件,大约50 - 100 MB
,内容为'Added first line',应该插入到文件中400万次

解决方案

使用旧式文件io



fopen

fseek 转换为所需的文件大小 - 1. 一个字节

fclose 文件

Create a flat text file in c++ around 50 - 100 MB with the content 'Added first line' should be inserted in to the file for 4 million times

解决方案

using old style file io

fopen the file for write.

fseek to the desired file size - 1.

fwrite a single byte

fclose the file

这篇关于最快的方式来创建大型文件在C + +?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆