c++ - Segmentation fault in small text processing program -


To read some input files and write values ​​of an array, I have the C ++ function read_inputdata . I <

But I get a split mistake, is there any idea that I have done wrong?

  #define defined MAX 140160 zero_input.dta (double input [max], four files [40]); Four input file 1 [40] = "Input / Hasei 04 / FR_His_DropTT"; Std :: cout & lt; & Lt; "Announce array" & lt; & Lt; Std :: endl; Double input 1 [max]; Std :: cout & lt; & Lt; "Calling function watch_input.data" & lt; & Lt; Std :: endl; Read_inputdata (Input 1, Input File 1);   

When I compile and run it, I get:

  declare the ARA function read_inputdata segmentation error   

That's why he currently calls the function read_inputdata something goes wrong, because it's std :: cout & lt; & Lt; "Function watch_input.data" & lt; & Lt; Std :: endl; .

Function:

  zero read_inputdata (double input [max], four files [40]) {std :: cout & lt; & Lt; "Function watch_input.data" & lt; & Lt; Std :: endl; Std :: ifstream inputfile; Inputfile.open (files); If (inputfile.is_open ()) {char temp [100]; Double Gullag [2] [Max]; Int i = 0; While (! Inputfile.getline (temp, 100) .eof ()) {char delims [] = "\ t,"; Four * result = null; Results = temp, delms; Int j = 0; While (result! = Null) {getal [j] [i] = etf (result); Results = Stroke (tap, dellim's); J ++; } I ++; } Inputfile.close (); For (int i = 0; i & lt; MAX; i ++) {input [i] = match [1] [ii]; }} And STD :: COAT & LT; & Lt; "WARNING: Unable to open file" & lt; & Lt; Std :: endl; }   

Probably going out of the stack, please pointers, dynamic allocation and even better Use the.

  # 140160 Readable input input to Madonna (double * input, four * files); Four input file 1 [40] = "Input / Hasei 04 / FR_His_DropTT"; Std :: cout & lt; & Lt; "Announce array" & lt; & Lt; Std :: endl; Double * input 1 = new double [max]; Std :: cout & lt; & Lt; "Calling function watch_input.data" & lt; & Lt; Std :: endl; Read_inputdata (Input 1, Input File 1);    

Comments