I do mini DB, and there was such a problem. The database works through structures, i.e. There are adding entries to the file.
void write(FILE *file, int readCount, Student *notes, int writeCount) { fseek(file, readCount * sizeof(Student), SEEK_SET); for(int z = 0; z < writeCount; z++){ fwrite(¬es[z], sizeof(Student), 1, file); } } And reading:
 Student *read(FILE *file, long int a) { fseek(file, 0, SEEK_SET); Student *readfile = new Student[a]; fread(readfile, sizeof(Student), a, file); return readfile; } Structure:
 struct Student { char firstname[30]; char secondname[30]; char lastname[30]; int age; int course; int group; }; OS: Windows
The problem is that when I want to add an entry in Russian, it is added, but when read, it displays the wrong encoding. How can I fix this?
char * field;orstd::string field;. With this approach, the above method of saving records will not work normally. And the flown encoding is still a small problem. Show the definition of theStudentstructure. Compile the code as much as I can, and the other participants. - KoVadim