basic read write function example