add write.cpp