I think you may be sending to a mailing list that isn't really appropriate for your questions; this list concerns integrating C++ with Python (often focusing on Boost.Python), not general C/C++ programming.
Good luck! Jim On 09/30/2013 11:40 AM, sam wrote:
Hello, I wrote a C program that loop inside a folder which has about 200 text files. Each file has almost 60000 lines. I created 2D array [60000][200] to store files in it. No compilation problem at all, but when I try to run it I get this error (fault core dump). Yes I did use malloc() This is my code: /////////////// #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define WIDTH 200 // total number of files #define HEIGHT 60000 // total number of lines for each file int main () { double **array1; array1 [HEIGHT][WIDTH]; int w ,h; int fnum = 1; char filename [64]; double *data; FILE * fpr; FILE * fpw; // reading files data to array1 array1 = (double **) malloc(HEIGHT*sizeof(double)); for (w=0;w<WIDTH;w++) { sprintf(filename, "C:/User/data%d.txt", fnum); ; fpr = fopen(filename, "r"); for (h=0;h<HEIGHT;h++) { array1[h] = (double *) malloc(WIDTH*sizeof(double)); fscanf(fpr, "%lf", &array1 [h][w]); fclose(fpr); } fnum ++; } return 0; } //////////////// Thank you, Sam _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig