set directory first then set file name
remove cast to char*, not needed