当数据量很大的时候,GetPrivateProfileSection()为什么获取的数据只有少一半。

从一个很大的数据量里读取数据,但是GetPrivateProfileSection函数,读取文档中的数据时,把某一行读取到一半就自动读取下一行的内容,而非全部读取完。但当数据量很小的时候,读取正常。(我用的编程语言是C#)

具体要看你的代码,怎么调用的。
但是你用C#去读取ini,实际上不需要调用api

直接用var line = System.IO.File.ReadAllLines(文件名)
之后用line.SkipWhile(x => x != "[小节名]");
就可以找到小节,之后就可以读取其中的配置了

如果你需要一个完整的代码例子:
1 请你采纳我的回答。
2 将你的ini文件上传到 download.csdn.net 设置0积分,给出你要获取的配置项。

我可以用C#写给你。

除结尾外,你这一行是不是有两个连续null,导致函数认为这行已结束

lpReturnedString

A pointer to a buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.

看官方说明https://docs.microsoft.com/zh-cn/windows/win32/api/winbase/nf-winbase-getprivateprofilesection
图片说明
看你有没有写了终止符,以及缓冲够不够