且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何知道缓冲区大小并增加c ++中的缓冲区大小

更新时间:2022-10-15 09:45:49



" Raja" < SH ******* @ yahoo.com>在消息中写道

news:b2 ************************* @ posting.google.co m ... 如何知道缓冲区大小并增加c ++中的缓冲区大小。




缓冲区大小是什么?


john




" Raja" < SH ******* @ yahoo.com>在消息中写道

news:b2 ************************* @ posting.google.co m ... 如何知道缓冲区大小


决定你想要的大小,并记住它。

并增加c ++中的缓冲区大小。




在上面添加所需的金额,并且

将其更改为新的大小。


也许如果你更具体,我们可以给你一个更具体的答案。

-Mike


Raja写道:

如何知道缓冲区大小并增加c ++中的缓冲区大小。




没有C ++中的内在支持能够确定一个任意分配的内存块(缓冲区?)的大小。你必须跟踪内存

自己阻止。


要增加大小(必要时),你只需要分配一个新的部分

的内存大小合适,复制过去的内容为

新的,更新前面的引用指向新的,然后

发布前一个。


How to know the buffer size and increase buffer size in c++.


"Raja" <sh*******@yahoo.com> wrote in message
news:b2*************************@posting.google.co m...
How to know the buffer size and increase buffer size in c++.



Buffer size of what?

john



"Raja" <sh*******@yahoo.com> wrote in message
news:b2*************************@posting.google.co m...
How to know the buffer size
Decide what size you want, and remember that.
and increase buffer size in c++.



Add the desired amount to the above, and
change it to the new size.

Perhaps if you''d be more specific, we could
give a more specific answer.
-Mike


Raja wrote:

How to know the buffer size and increase buffer size in c++.



There is no intrinsic support in C++ to be able to determine the size of an
arbitrary allocated memory block (buffer?). You must keep track of the memory
block yourself.

To increase the size (when necessary), you simply need to allocate a new piece
of memory that is of suitable size, copy over the contents of the previous to
the new, update references to the previous to point to the new, and then
release the previous.