For the actual buffer processing, the function is perfectly capable of handling zero-sized buffers by simply returning.
对于实际的缓冲区处理,函数只需直接返回,就能够很好地处理大小为零的缓冲区。
For the buffer processing, the MFC treats a zero-size data request as a no-op, so I can go ahead and issue requests even if there is no data to read.
对于缓冲区处理,MFC 将大小为零的数据请求当作无操作来对待,所以即使没有数据可读取了,也可以继续发出请求。
Also, both functions guarantee that the destination will be NUL-terminated as long as the size is at least one (you can't put anything into a zero-length buffer).
此外,只要目标的大小至少为1,两个函数都保证目标将以NUL结尾(您不能将任何内容放入零长度的缓冲区)。
In general, one useful approach is to pass a length to the 'counted string' function one smaller than the size of the buffer and then explicitly assign zero to the last character in the buffer.
通常,一种有用的方法是,向“计数字符串”函数传递比缓冲区大小小一的长度,然后将零显式赋给缓冲区中的最后一个字符。
In general, one useful approach is to pass a length to the 'counted string' function one smaller than the size of the buffer and then explicitly assign zero to the last character in the buffer.
通常,一种有用的方法是,向“计数字符串”函数传递比缓冲区大小小一的长度,然后将零显式赋给缓冲区中的最后一个字符。
应用推荐