added util file, fixed duplicate write definition

removed most references to std::string to fix problem
where write was already defined, because std::string
includes unistd.h which defines write