implemented open.c thanks to Aditya ..;)