>if (rename(oldname,newname) == '\0');
なにこれ -> '\0'