in reply to storing hex data in a file

print chr(0x55)
PS when you say 'hex', I think you mean 'binary'. Hex is an ASCII representation of binary data, which is why people gave you answers which were correct but not what you wanted.

Dave.