Форум программистов, компьютерный форум, киберфорум
С++ для начинающих
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.71/7: Рейтинг темы: голосов - 7, средняя оценка - 4.71
0 / 0 / 0
Регистрация: 25.12.2016
Сообщений: 1

Не получается разобраться с ошибкой: app.exe has triggered a breakpoint

25.12.2016, 19:15. Показов 1420. Ответов 1
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Задание:
Считать информацию с одного файла и вывести в другой.
Для 4 структур сделал 4 указателя для файлов. Не могу найти, почему выбивает данную ошибку.
C++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <conio.h>
#include <string.h>
 
int list_length, prof_amount, doc_amount, assist_amount, senior_amount;
float z, y, x, w;
 
FILE *f_point;
FILE *d_point; 
FILE *a_point;
FILE *l_point;
 
struct prof {
    char university[40];
    char name[40];
    char zvannya[40];
    char posada[40];
    struct prof *next_prof;
} *first_pr, *cur_pr, *next_pr;
 
struct doc {
    char university[40];
    char name[40];
    char zvannya[40];
    char posada[40];
    char ktn[40];
    struct doc *next_docent;
} *first_doc, *cur_doc, *next_doc;
 
struct assistant {
    char university[40];
    char ktn[40];
    char name[40];
    struct assistant *next_assistant;
} *first_ass, *cur_ass, *next_ass;
 
struct lecturer {
    char university[40];
    char ktn[40];
    char name[40];
    struct lecturer *next_lecturer;
} *first_lec, *cur_lec, *next_lec;
 
 
 
 
int Open_Input_File1();
int Open_Input_File2();
int Open_Input_File3();
int Open_Input_File4();
 
int File_First_Prof();
int File_First_Doc();
int File_First_Ass();
int File_First_Lec();
 
int File_Prof();
int File_Doc();
int File_Ass();
int File_Lec();
 
int Open_Output_File1();
int Open_Output_File2();
int Open_Output_File3();
int Open_Output_File4();
 
void Write_Inf_To_File1();
void Write_Inf_To_File2();
void Write_Inf_To_File3();
void Write_Inf_To_File4();
 
 
int main() {
    char inp;
    prof_amount = 0; doc_amount = 0; assist_amount = 0; senior_amount = 0;
 
    do {
        printf("Press any button to start\n");
    
 
        Open_Input_File1 ();
        File_First_Prof ();
        while (!File_Prof ());
        File_Prof ();
        int Open_Output_File1 ();
        Write_Inf_To_File1 ();
 
 
        Open_Input_File2 ();
        File_First_Doc ();
        while (!File_Doc ());
        File_Doc();
        Open_Output_File2 ();
        Write_Inf_To_File2 ();
 
        
        Open_Input_File3 ();
        File_First_Ass ();
        while (!File_Ass ());
        File_Ass ();
        Open_Output_File3 ();
        Write_Inf_To_File3 ();
 
 
        Open_Input_File4 ();
        File_First_Lec ();
        while (!File_Lec ());
        File_Lec ();
        Open_Output_File4 ();
        Write_Inf_To_File4 ();
        
 
        printf("\nEnter 1 to reexecute the program, or any other symbol to quit\n");
        printf("\n");
        scanf("%c", &inp);
    } while (inp == '1');
 
    return 0;
}
 
int Open_Input_File1() {
    f_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/prof.txt", "r");
    if (f_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
int Open_Input_File2() {
    d_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/doc.txt", "r");
    if (d_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
int Open_Input_File3() {
    a_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/assist.txt", "r");
    if (a_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
int Open_Input_File4() {
    l_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/lect.txt", "r");
    if (l_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
 
int File_First_Prof() {
    list_length = 1;
    prof_amount = 1;
    first_pr = (struct prof*)malloc(sizeof(struct prof));
    if (first_pr == NULL) {
        printf("\nNULL pointer for first_pr");
        return 1;
    }
    cur_pr = first_pr;
    fscanf (f_point, "%s", first_pr->university);
    fscanf (f_point, "%s", first_pr->posada);
    fscanf (f_point, "%s", first_pr->zvannya);
    fscanf (f_point, "%s", first_pr->name);
 
    return 0;
}
 
int File_First_Doc() {
    list_length = 1;
    doc_amount = 1;
    first_doc = (struct doc*)malloc(sizeof(struct doc));
    if (first_doc == NULL) {
        printf("\nNULL pointer for first_doc");
        return 1;
    }
    cur_doc = first_doc;
    
    fscanf (d_point, "%s", first_doc->university);
    fscanf (d_point, "%s", first_doc->posada);
    fscanf (d_point, "%s", first_doc->zvannya);
    fscanf (d_point, "%s", first_doc->name);
 
    return 0;
}
 
int File_First_Ass() {
    list_length = 1;
    assist_amount = 1;
    first_ass = (struct assistant*)malloc(sizeof(struct assistant));
    if (first_ass == NULL) {
        printf("\nNULL pointer for first_ass");
        return 1;
    }
    cur_ass = first_ass;
    
    fscanf(a_point, "%s", first_ass->university);
    fscanf(a_point, "%s", first_doc->ktn);
    fscanf(a_point, "%s", first_doc->name);
 
    return 0;
}
 
int File_First_Lec() {
    list_length = 1;
    assist_amount = 1;
    first_lec = (struct lecturer*)malloc(sizeof(struct lecturer));
    if (first_ass == NULL) {
        printf("\nNULL pointer for first_doc");
        return 1;
    }
    cur_ass = first_ass;
    
    fscanf(l_point, "%s", first_ass->university);
    fscanf(l_point, "%s", first_ass->ktn);
    fscanf(l_point, "%s", first_ass->name);
 
    return 0;
}
 
 
int File_Prof() {
    
    next_pr = (struct prof*)malloc(sizeof(struct prof));
    if (next_pr == NULL) {
        printf("\nNULL pointer for next_pr");
        return 1;
    }
    if (feof(f_point)) {
        //free (next_st);
        cur_pr->next_prof = NULL;
        fclose (f_point);
        return 1;
    }
 
    fscanf(f_point, "%s", first_pr->university);
    prof_amount++;
    fscanf(f_point, "%s", first_pr->posada);
    fscanf(f_point, "%s", first_pr->zvannya);
    fscanf(f_point, "%s", first_pr->name);
 
    cur_pr->next_prof = next_pr;
    cur_pr = next_pr;
    list_length++;
    return 0;
}
 
int File_Doc() {
    
    next_doc = (struct doc*)malloc(sizeof(struct doc));
    if (next_doc == NULL) {
        printf("\nNULL pointer for next_doc");
        return 1;
    }
    if (feof(d_point)) {
        //free (next_st);
        cur_doc->next_docent = NULL;
        fclose(d_point);
        return 1;
    }
 
 
    
    fscanf(d_point, "%s", first_doc->university);
    doc_amount++;
    fscanf(d_point, "%s", first_doc->posada);
    fscanf(d_point, "%s", first_doc->zvannya);
    fscanf(d_point, "%s", first_doc->name);
 
    cur_doc->next_docent = next_doc;
    cur_doc = next_doc;
    list_length++;
    return 0;
}
 
int File_Ass() {
    next_ass = (struct assistant*)malloc(sizeof(struct assistant));
    if (next_ass == NULL) {
        printf("\nNULL pointer for next_ass");
        return 1;
    }
    if (feof(a_point)) {
        //free (next_ass);
        cur_ass->next_assistant = NULL;
        fclose(a_point);
        return 1;
    }
    
 
 
    fscanf(a_point, "%s", first_ass->university);
    assist_amount++;
    fscanf(a_point, "%s", first_ass->ktn);
    fscanf(a_point, "%s", first_ass->name);
 
    cur_ass->next_assistant = next_ass;
    cur_ass = next_ass;
    list_length++;
    return 0;
 
}
 
int File_Lec() {
    next_lec = (struct lecturer*)malloc(sizeof(struct lecturer));
    if (next_lec == NULL) {
        printf("\nNULL pointer for next_lec");
        return 1;
    }
    if (feof(l_point)) {
        //free (next_lec);
        cur_lec->next_lecturer = NULL;
        fclose(l_point);
        return 1;
    }
    
 
 
    fscanf(l_point, "%s", first_ass->university);
    senior_amount++;
    fscanf(l_point, "%s", first_ass->ktn);
    fscanf(l_point, "%s", first_ass->name);
 
    cur_lec->next_lecturer = next_lec;
    cur_lec = next_lec;
    list_length++;
    return 0;
 
}
 
int Open_Output_File1() {
    f_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/out_prof.txt", "w");
    if (f_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
int Open_Output_File2() {
    d_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/out_doc.txt", "w");
    if (d_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
int Open_Output_File3() {
    a_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/out_assist.txt", "w");
    if (a_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
int Open_Output_File4() {
    l_point = fopen("C:/Users/admin/Desktop/KPI/laba9_10vvod/out_lect.txt", "w");
    if (l_point == NULL) {
        printf("File with input data wasn't found");
        return 1;
    }
    return 0;
}
 
 
void Write_Inf_To_File1() {
    cur_pr = first_pr;
    
    fprintf(f_point, " | university     | posada     | zvannya     | name      |\n"
        "|----------------+------------+----------------+-------------|\n");
    do {
        fprintf(f_point, "| %14s | %10s | %10s | %8s |\n", cur_pr->university, cur_pr->posada, cur_pr->zvannya, cur_pr->name);
        struct prof *temp;
        temp = cur_pr;
        cur_pr = cur_pr->next_prof;
        free(temp);
    } while (cur_pr != NULL);
    
    fflush(f_point);
    fclose(f_point);
}
 
void Write_Inf_To_File2() {
    cur_doc = first_doc;
 
    fprintf(d_point, " | university     | posada     | zvannya     | name      |\n"
        "|----------------+------------+----------------+-------------|\n");
    do {
        fprintf(d_point, "| %14s | %10s | %10s | %8s |\n", cur_doc->university, cur_doc->posada, cur_doc->zvannya, cur_doc->name);
        struct doc *temp;
        temp = cur_doc;
        cur_doc = cur_doc->next_docent;
        free(temp);
    } while (cur_doc != NULL);
 
    fflush(d_point);
    fclose(d_point);
}
 
void Write_Inf_To_File3() {
    cur_ass = first_ass;
 
    fprintf(a_point, " | university     | ktn     | name      |\n"
        "|-------------+--------------+-------------|\n");
    do {
 
        fprintf(a_point, "| %14s | %10s | %8s |\n", cur_ass->university, cur_ass->ktn, cur_ass->name);
        struct assistant *temp;
        temp = cur_ass;
        cur_ass = cur_ass->next_assistant;
        free(temp);
    } while (cur_ass != NULL);
    
    fflush(a_point);
    fclose(a_point);
}
 
void Write_Inf_To_File4() {
    cur_lec = first_lec;
 
    fprintf(l_point, " | university     | ktn     | name      |\n"
        "|-------------+--------------+-------------|\n");
    do {
 
        fprintf(l_point, "| %14s | %10s | %8s |\n", cur_lec->university, cur_lec->ktn, cur_lec->name);
        struct lecturer *temp;
        temp = cur_lec;
        cur_lec = cur_lec->next_lecturer;
        free(temp);
    } while (cur_lec != NULL);
    
    fflush(l_point);
    fclose(l_point);
}
0
cpp_developer
Эксперт
20123 / 5690 / 1417
Регистрация: 09.04.2010
Сообщений: 22,546
Блог
25.12.2016, 19:15
Ответы с готовыми решениями:

App.exe has triggered a breakpoint
Здравствуйте. Я пытаюсь создать класс Management для управления студентами. Реализую функцию добавления нового студента в список, но...

Компилятор выдает ошибку app.exe has triggered a breakpoint
Парни C++ только начал изучать как пол года назад. Ссори если не правильно высказываюсь. Делаю задачку. Не могу врубиться почему...

Компилятор выдаёт ошибку app.exe has triggered a breakpoint
При завершении работы программы выдаёт ошибку app.exe has triggered a breakpoint, при этом все функции выполнились, подскажите пожалуйста...

1
1272 / 1029 / 470
Регистрация: 25.12.2016
Сообщений: 3,333
25.12.2016, 23:15
Цитата Сообщение от chrom25 Посмотреть сообщение
почему выбивает данную ошибку.
Данную это какую? Тебе бы локализовать место, где происходит ошибка, уж больно длинный у тебя код.
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
raxper
Эксперт
30234 / 6612 / 1498
Регистрация: 28.12.2010
Сообщений: 21,154
Блог
25.12.2016, 23:15
Помогаю со студенческими работами здесь

Выскакивает окно с ошибкой "ConsoleApplication.exe has triggered a breakpoint" при использовании free
char **line = reinterpret_cast&lt;char**&gt;(malloc(4*sizeof(char))); for (int i = 0; i &lt; 4; i++) { line =...

Stalin.exe has triggered a breakpoint
Здравствуйте! У меня возникла проблема, по которой я не могу найти решения в интернете. Собственно, после введения любой строки в...

HoughTransformV4.exe has triggered a breakpoint
Помогите=) стоит только попытаться применить любую операцию округления выдает такое сообщение: HoughTransformV4.exe has triggered a...

Ошибка .exe has triggered a breakpoint
вылетает, когда делаю delete, если delete стоит перед strcpy, то всё норм #include&lt;iostream&gt; void Perevod(char*,int...

Windows has triggered a breakpoint in .exe
Столкнулся с такой ошибкой(скрин в вложениях) Код OPENFILENAME ofn; wchar_t nameFile = {0}; wchar_t szFile = {0}; ...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
2
Ответ Создать тему
Новые блоги и статьи
Конвертировать закладки radiotray-ng в m3u-плейлист
damix 19.02.2026
Это можно сделать скриптом для PowerShell. Использование . \СonvertRadiotrayToM3U. ps1 <path_to_bookmarks. json> Рядом с файлом bookmarks. json появится файл bookmarks. m3u с результатом. # Check if. . .
Семь CDC на одном интерфейсе: 5 U[S]ARTов, 1 CAN и 1 SSI
Eddy_Em 19.02.2026
Постепенно допиливаю свою "многоинтерфейсную плату". Выглядит вот так: https:/ / www. cyberforum. ru/ blog_attachment. php?attachmentid=11617&stc=1&d=1771445347 Основана на STM32F303RBT6. На борту пять. . .
Камера Toupcam IUA500KMA
Eddy_Em 12.02.2026
Т. к. у всяких "хикроботов" слишком уж мелкий пиксель, для подсмотра в ESPriF они вообще плохо годятся: уже 14 величину можно рассмотреть еле-еле лишь на экспозициях под 3 секунды (а то и больше),. . .
И ясному Солнцу
zbw 12.02.2026
И ясному Солнцу, и светлой Луне. В мире покоя нет и люди не могут жить в тишине. А жить им немного лет.
«Знание-Сила»
zbw 12.02.2026
«Знание-Сила» «Время-Деньги» «Деньги -Пуля»
SDL3 для Web (WebAssembly): Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 12.02.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами и вызывать обработчики событий столкновения. . . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL_LoadPNG (без SDL3_image)
8Observer8 11.02.2026
Содержание блога Библиотека SDL3 содержит встроенные инструменты для базовой работы с изображениями - без использования библиотеки SDL3_image. Пошагово создадим проект для загрузки изображения. . .
SDL3 для Web (WebAssembly): Загрузка PNG с прозрачным фоном с помощью SDL3_image
8Observer8 11.02.2026
Содержание блога Библиотека SDL3_image содержит инструменты для расширенной работы с изображениями. Пошагово создадим проект для загрузки изображения формата PNG с альфа-каналом (с прозрачным. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru