rendered paste bodyint _open(FILE* openfile, char *path, float ***matrix){ openfile = fopen(path, "r"); if (openfile == NULL) return 0; // Datei existiert (hoechswahrscheinlich) nicht. // Matrixsize checken //// Erster Eintrag in Datei ist die Groesse der Matrix als int. (z.B. 3 --> 3x3 Matrix) int size = 0; fscanf(openfile, "%i\n", &size); // Matrix memory allocation genoutmatrix(matrix, size); // Ugly hack incoming (pt.1) float *mmatrix = (float*)malloc(size*size); // Datei auslesen int i = 0, j = 0, n = 0; float buff; while ( !feof(openfile) ) { fscanf(openfile, "%f\n", &buff); // Hack, pt. 2 mmatrix[i++] = buff; } // Copy hack in 2d array (1d --> 2d transfer) for (i = 0; i < size; ++i) { for (j = 0; j < size; ++j) { (*matrix)[i][j] = mmatrix[n++]; } } fclose(openfile);}