This is a discussion on problem with array transport between programs within the C Programming forums, part of the General Programming Boards category; Originally Posted by vtergolina Yeah, it worked which means my problems are worst than i thought, thank you anyway, you ...
So it basicalys read the arrays X and Y of each specter and them passes one by one to the older program so he can filter it them, i wanted it to give back to the new program the awnser which is the integral of the filtred specter, the integral also was calculated on the older program.
Did you actually change the code of the original, or are you trying to make "function" your filter? You'll want to make sure you are calling the original code with the data it expects (unwrapping these 4000-long arrays, etc.)
I didn't notice before, but you wrote "Cor = ..." in your original snippet above. That's not going to get you anywhere. You only assign to individual slots of an array.
I changed the code so it should be geting the arrays from the new program like it used to get from the fscanf back when it filtered one specter at time. But i don know if it is geting the arrays because i tried printing from the function and still giving me 0.0 as awnser so its probably no geting the arrays. I know the new program is reading the arrays fine because i tested it before trying to put it togheter with the new.
We don't know either because we don't have any code to work off of. Try to break this down to as simple of an implementation that you can and show us what you have.
My problem is that the way i specified it on the new program aparently isnt enough to pass the arrays Sx[j] and h[j] to the older.
Found my error guys. the Cor parameter was giving 0.0000 because i was trying to print it as %f, changed it to %e and it gave me the right value, thanks for the help!
Frankly I'm amazed it runs at all...Code:#define N 4000 char L[N]; signed char x[N]; float Sx[N], h[N], c[N], Cor[N];
These arrays are enormous... over 8 megs of data created on your program's stack.
Your L array alone is 4 megs...
Most programs only have a 1meg stack...
You seriously need to look into using malloc() and free() to create these arrays.