PDA

Click to See Complete Forum and Search --> : Clearing an array of characters


parksie
Apr 27th, 2001, 07:26 AM
char buf[90];
memset(buf, 0, 90);

Yonatan
Apr 27th, 2001, 07:42 AM
Remember that if you want to just make a string empty, you don't have to zero out all the characters, but only the first.
This will make the string pretend it's empty - even strlen will return zero. :rolleyes:
(The string won't really be empty, but most string functions usually think that the string ends at the first zero character)

buf[0] = 0;