memset(buffer, 20, '\0'); Possible newbie coding error in that the 2nd & 3rd parameter look the wrong way around to me. Also, the coding police have noticed a lot of mentions of the fixed constant "20" in the same routine. Possible improve style by replacing by a sizeof expression or other symbolic constant ?