started part of write() and read(), made char line[] global