파일 포인터 배열을 만들었고 코어 덤프를 받았습니다. 모든 것을 하나의 파일에 쓰면 프로그램이 정상적으로 작동합니다. 이것에 대한 이유는 무엇입니까?C 프로그램 (코어 덤프)에서 16 개 파일을 열 수 없습니다.
이것은 작동합니다.
unsigned char error_array[4][4][256]
FILE *hypo_table;
hypo_table = fopen("00.txt", "w");
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
for(hypo_key = 0; hypo_key < 256; hypo_key++) {
//process error_array
fprintf(hypo_table, "%.2x ", error_array[i][j][hypo_key]);
if(hypo_key == 255)
break;
이것은 작동하지 않습니다 (코어 덤프).
unsigned char error_array[4][4][256]
FILE *hypo_table[4][4];
hypo_table[0][0] = fopen("00.txt", "w");
hypo_table[1][0] = fopen("10.txt", "w");
hypo_table[2][0] = fopen("20.txt", "w");
hypo_table[3][0] = fopen("30.txt", "w");
hypo_table[1][0] = fopen("10.txt", "w");
hypo_table[1][1] = fopen("11.txt", "w");
hypo_table[1][2] = fopen("12.txt", "w");
hypo_table[1][3] = fopen("13.txt", "w");
hypo_table[2][0] = fopen("20.txt", "w");
hypo_table[2][1] = fopen("21.txt", "w");
hypo_table[2][2] = fopen("22.txt", "w");
hypo_table[2][3] = fopen("23.txt", "w");
hypo_table[3][0] = fopen("30.txt", "w");
hypo_table[3][1] = fopen("31.txt", "w");
hypo_table[3][2] = fopen("32.txt", "w");
hypo_table[3][3] = fopen("33.txt", "w");
for(i = 0; i < 4; i++) {
for(j = 0; j < 4; j++) {
for(hypo_key = 0; hypo_key < 256; hypo_key++) {
//process error_array
fprintf(hypo_table[i][j], "%.2x ", error_array[i][j][hypo_key]);
if(hypo_key == 255)
break;
어떤 줄에서 실패합니까? –
i = 0, j = 0, hypo_key = 255 – drdot
그럼 error_array [i] [j] [hypo_key]는 어떻게됩니까? – paulsm4