I am writing a program for counting characters from a binary file. The number of characters counts, outputs, but after counting, instead of completing the program, such an exception pops up.
It does not point to my code, it points to the istype.c file. I went and looked at line 68
_ASSERTE(c >= -1 && c <= 255); I suppose that I had missed some encoding, because if my code were cursed, everything would point to it.
The debugger shows all the correct values correctly.
Part of the code (the number of repeated characters is displayed here)
void calculate_symb(FILE* fd) { int max = 0; fd = fopen("test.dat", "rb"); if (!fd) printf("Ошибка!Файл не найден!\n"); else { fseek(fd, 0L, SEEK_END); long fsize = ftell(fd); int n = fsize; cout << "Количество символов в файле = " << fsize << endl; char* symv = new char[n]; fseek(fd, 0L, SEEK_SET); cout << "Вывод содержимого двоичного файла:" << endl; for (int i = 0; i < n; i++) { fread(symv, sizeof(char), n, fd); cout << symv[i]; } fclose(fd); cout << endl; cout << "Повторяющиеся символы" << endl; for (int x = 0; x < 255; x++) { bool flag = true; if (isalnum(symv[x])) for (int y = x - 1; y >= 0 && flag; y--) if (symv[x] == symv[y]) flag = false; if (flag && isalnum(symv[x])) cout << "\"" << symv[x] << "\"" << " -> " << count(symv, symv + 255, symv[x]) << endl; } } } 

FILE*fdas a parameter? ... And who will free up memory undersymv? And - it does not bother you that the program gives incorrect results (where are the tworin your word?)? - Harry