memset Usage 
Author Message
 memset Usage

const int NUMOFBALLS =  75;

class CARD
{
private:

public:
    CARD();                                            

    ~CARD();                                            

    typedef struct
    {
        BYTE cBallsCalled[NUMOFBALLS+1];        
        BYTE cBallsOrdered[NUMOFBALLS+1];      
        BYTE cBallsDaubed[NUMOFBALLS+1];        
        BYTE cNewBall;  
        BYTE cCallCnt;
        BYTE cSpare[2];
    } BALLSCALLED;

    BALLSCALLED bcBalls;

Quote:
}

CARD card;  // instance of the CARD class

memset(&card.bcBalls.cBallsCalled, NULL, sizeof
(card.bcBalls.cBallsCalled));

Is the memset statement correct for properly NULL'ing out
cBallsCalled?

Thanks in advance.



Wed, 23 Feb 2005 06:19:04 GMT  
 memset Usage

Quote:
> Is the memset statement correct for properly NULL'ing out
> cBallsCalled?

you should put code like that int he constructor for the CARD class, but
otherwise, yes, it's fine.

-cd



Wed, 23 Feb 2005 06:45:04 GMT  
 memset Usage
Thanks, I want to confirm that the "card.bcBalls." front
end to "card.bcBalls.cBallsCalled" is used correctly as
input variables to the memset (and sizeof) function(s).

Quote:
>-----Original Message-----


>> Is the memset statement correct for properly NULL'ing
out
>> cBallsCalled?

>you should put code like that int he constructor for the
CARD class, but
>otherwise, yes, it's fine.

>-cd

>.



Wed, 23 Feb 2005 06:58:40 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. memset usage question

2. MEM Usage and CPU Usage

3. Usage of MFC & Usage of Platform SDK or Usage of MF Framework

4. Usage of MFC & Usage of Platform SDK or Usage of MF Framework

5. memset with void pointer and zero length

6. memset problem

7. memset core dump

8. using memset() to clear struct contents

9. malloc & memset versus calloc

10. memset and NULL?

11. differnce between Memset and simple initilization

12. string comparison after memset

 

 
Powered by phpBB® Forum Software