I have a mistake in the function for reading the file but I don't know what is wrong. all the symbols are read correctly when the symbol is beyond the ASCII table.
while ((c = fgetwc(file)) != WEOF) {
if (c != L'\n') {
if (i == buf_length) {
buf_length += BUF;
wchar_t *rebuf = realloc(tmp, buf_length * sizeof(wchar_t));
if (rebuf == NULL) {
free(tmp);
tmp = NULL;
buf_length = 0;
return EALLOC;
} else {
tmp = rebuf;
}
}
tmp[i] = (wchar_t)c;
i++;
} else {
list->size++;
tmp[i] = L'\0';
insertLast(list, tmp);
i = 0;
}