1. what does 'from' contain? nothing as far as your code shows
2. you only read one character from the file and then did not use it.
3. your 'to' was malloc'ed for 6 characters but malloc doesn't...