T
T
Themidis Koudes2020-07-07 19:00:31
C++ / C#
Themidis Koudes, 2020-07-07 19:00:31

What is the cause of the _Pnext error in C++?

It is required to take part of the data from one text file, and the other from a binary one.

void zapoln_script() {
FILE *from_sc, *to, *from_txt;
fopen_s(&from_sc, "scenario.txt", "r");
fopen_s(&from_txt, "ru.txt", "rb");
//fopen_s(&to, "Tsest.bov", "wb");

//fopen_s(&f, "one.save", "wb");

scrpt a;
int i, a1, a2, a3, a4;
Tx b;


while (fscanf_s(from_sc, "%d %d %d %d", &a1, &a2, &a3, &a4) != EOF) {
a.num = a1;
a.chs = a2;
a.scn = a3;
a.kolvo = a4;
a.renew_mem();
for (i = 0; i < a.kolvo; i++) {
fread(&b, 1, sizeof(Tx), from_txt);
if (b.num == a.num) {
a.repls[i] = b.st;
}
else cout « a.num « b.num « "ERROR\n";

}
a.print();
};
fclose(from_sc);
fclose(from_txt);
//fclose(to);
}

Gives an error:
Thread 0x26ac terminated with code 0 (0x0).
Exception thrown: Read access violation.
**_Pnext** was 0x102CB34.
, and redirects to xutility file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-07-07
@jcmvbkbc

What is the reason for the error with _Pnext

It is not visible from here, but at least you have not checked anywhere that the input files were successfully opened.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question