change call function

replace 'dir' function to 'opendir' and 'readdir' function