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;
        }
有帮助吗?

解决方案

Is _UNICODE defined? Also, check that you do not get an error (use ferror and feof) when you encounter WEOF as it could mean either.

http://msdn.microsoft.com/en-us/library/c7sskzc1%28v=vs.71%29.aspx

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top