Hi,
I am rewriting some code from having a regular pointer to where the pointer is in a struct.
This is the original code which works:
int wrote = sf_writef_double(outfile, *mono_channel, frames);
In the new code, where I have put the mono_channel pointer in a struct have I written
int wrote = sf_writef_double(outfile, data->mono_channel, frames);
The compiler doesn't complain, but the program crashes.
So the question is. Is data->mono_channel
the same as *mono_channel
?
Hugs, Louise
Edit: To be more precise here is what I do:
ltfat_complex* fm;
fm = malloc(data->L * sizeof(ltfat_complex));
if (fm == NULL) { puts("fm malloc failed"); exit(1); }
/* Writes output to fm */
idgt_fac(data->coef, gdf, data->L, 1, 1, data->a, data->M, fm);
free(data->mono_channel);
data->mono_channel = (double*) fm;
free(fm);
...
int wrote = sf_writef_double(outfile_handler, data->mono_channel, frames);
Could the problem be, that I try to re-use the data->mono_channel
pointer?
Edit2: Here are the entire source codes (~ 700 lines each):
Old which works: http://www.student.dtu.dk/~s011392/gabor-io.zip
New: http://www.student.dtu.dk/~s011392/gui.zip
Sadly they require a lot of libraries to compile: ltfat from SVN, fftw3, lapack, blas, sndfile.
But there tey are =)