Since getwc is implemented as a macro, a file pointer argument with side effects (for example getwc (*f++)) might be evaluated incorrectly. In such a case, use the fgetwc function instead. See the fgetwc function.