如何在闪存中使用WriteFile API函数且偏移量不大于512的倍数? [英] How can I use WriteFile API funct with an offset not multiple of 512 inside my flash memory?

查看:165
本文介绍了如何在闪存中使用WriteFile API函数且偏移量不大于512的倍数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好..........
我现在使用此API函数实现ReadFile()之后,尝试使用WriteFile API函数将某些字节写入到我的闪存(pendrive)中.问题是我只能使用SetFilePointerEx()API函数以512字节偏移量的倍数移动指针,如果要以43字节偏移量进行写怎么办? 43不是512的倍数,那么使用SetFilePointerEx()不能到达那里.或者真的可以,但是不知道如何?????? ..有人可以帮助我吗?..

Hello..........
I''m now after achieving ReadFile() using this API function trying to write using WriteFile API function some bytes to my flash memory(pendrive). the problem is that I only can move the pointer using SetFilePointerEx() API function a multiple of 512 bytes offset, what if I want to write for example at 43 bytes offset? 43 is not multiple of 512 then a can''t get there using SetFilePointerEx().. or really a can but a don''t know how????..someone could help me?..

推荐答案

对仅支持页面边界写操作的设备进行部分页面写操作的典型方法是先将整个页面读入内存,然后更改要更改的字节在内存副本中,然后将整个页面写回.
The typical way of doing partial page writes to a device that only supports writes on page boundaries is to first read the entire page into memory, then change the bytes you want to change in your in memory copy, then write the entire page back out.


这篇关于如何在闪存中使用WriteFile API函数且偏移量不大于512的倍数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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