如何部分写入文件以及如何标记已经写入的部分? [英] How to write a file partially and how to mark which parts are already written?

查看:91
本文介绍了如何部分写入文件以及如何标记已经写入的部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在逐块获取文件的一部分.想像这样的东西:

i'm getting parts of a file in chunks. Think of something like this:

我知道整个文件的大小是:5000个字节

I know whole file size is: 5000 bytes

1.得到:pos 4000-5000

1. get: pos 4000-5000

2.得到:pos 2000-3050

2. get: pos 2000-3050

...

 

我的想法是:

1.)用0或类似的内容写入整个文件

1.) write the whole file with 0 or something like this

2.)然后将我得到的零件写到正确的位置

2.) then write the parts i get to the correct position

3.)我需要知道写了哪些部分以及缺少了哪些部分才能请求缺少的部分.有什么主意吗?

3.) i need to know which parts are written and which are missing to request the missing parts. Any idea?

Stefan

 

推荐答案

请参阅fseek(): http://msdn.microsoft.com/zh-cn/library/75yw9bf3(VS.71).aspx

See fseek() : http://msdn.microsoft.com/en-us/library/75yw9bf3(VS.71).aspx

亲切的问候,
罗布
www.robtso.nl

Kind regards,
Rob
www.robtso.nl


这篇关于如何部分写入文件以及如何标记已经写入的部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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