implemented 'midictrw' in c as 'cmidict'