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
Post a Comment