我創建了一個文件指針數組,並獲得核心轉儲。如果我將所有內容寫入一個文件,那麼我的程序運行良好。這是什麼原因?無法在C程序中打開16個文件(核心轉儲)
This Works。
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