In reply to cgales:
Thanks for your recommendation. But in my opinion, this is not the case. It only happens in case of 00. If there are non-zero bytes, the output is returned correctly. For example, if there is any character other than 00, its ascii value goes to the output. Also, if I try to append “00” as character, its ascii value 0x30 is appended. But I need 00.