c++ - How can I know where the segment of memory is all Zero -


I mean, I malloc to a block of memory, probably 1k maybe 20bytes .. Assume that the indicator pmem How can I find out that the content has been sent to pmem zero or \ 0 . I know the memcmp but the second parameter should have another memory address ... thanx

As other people have already suggested that you probably want or

But if you really want to see that the memory area is zero, then you can compare it with yourself, but you can move by one.

ex> bool allZero = pMem [0] == '\ 0' & amp; ! Memcom (PMM, PMM + 1, Length - 1);

Where the length is the number of bytes that you want to be zero


Comments

Popular posts from this blog

Is there an open source WebSockets (JavaScript) XMPP library? -

java - Is there an object like a "Set" that can contain only unique string values, but also contain a count on the number of occurrences of the string value? -

iphone - How do I make a UIPickerView in a UIActionSheet -