Couldn't you write just char buf[256] = 0; and it would zero the first array element?