开发者

Is there a size limit on WritePrivateProfileStruct?

I'm trying to write an INI file using the WritePrivateProfileStr开发者_C百科ing and WritePrivateProfileStruct functions.

I found that when the byte count is relatively low, WritePrivateProfileStruct and GetPrivateProfileStruct work fine, but with a higher byte count (62554 bytes in my case), the Write function seems to work but the Get function doesn't.

I haven't found any size limit for these functions on the MS documentation. Why is this happening?


Yes, I repro. The largest buffer I can read back is 32766 bytes. Larger values produce ERROR_BAD_LENGTH. With the checksum and the terminating zero, looks to me that it uses an internal buffer that is (32766+2) * 2 = 65536 bytes long. Makes somewhat sense, this is a legacy 16-bit API.

You really ought to consider using a regular file. But a workaround is to split the buffer in two.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜