On Oct 19, 1:06*pm, Werner <wer...@gmail.com> wrote:
> On Oct 19, 1:35*am, someone <newsbo...@gmail.com> wrote:
>
> > Thanks a lot for doing that! Fantastic work - I must say that I had to
> > add "include<stdlib.h>" for it to compile, but it looks really good
> > and definately, there's something I can learn from...
>
> Rather use <cstdlib>. It caters for c++ better (as opposed to c).
> Yes, the compiler I used did not require additional includes
> for NULL. I cut and paste the definition from the graph
> API without looking.
Ok. It's really great. I appreciate it a lot - extremely helpful for
me...
> > I tried to modify your code and use it on my own - however I get a
> > "segmentation fault" - not sure why...
>
> The code I gave you runs as is. You can view the output
> of this:
>
> http://ideone.com/JIlfF
>
> I've modified mysample_impl to access the reader as proof of
> concept. This would mean you have some problem in your code.
Yep - it's a really great example which I can learn (and have learned)
a lot from.
> In:
>
> gr.Window( argc, argv, mysample, "My Window", &myBinReader );
>
> I would make sure that myBinReader starts out simply. You can
Ok, my data passing / argument passing code works now... I just have
another problem, which I think I can solve myself... The plot looks
wrong... I think that the x-axis is wrong even though the text for the
xlabel looks right. I'm actually a bit disappointed about this mathgl-
library... But that is perhaps not something to discuss here...
> even make it an integer or a vector of ints to test the
> concept. Remember to replace the placeholders with the
> actual graph API...
Yep! It works (except that the graph looks wrong, but I think this is
a bug not related to the argument passing).
I spend approx. 5 hours figuring out what was wrong and why I got a
segmentation fault... Turned out that I had to replace this line:
gr.Window(argc,argv,mysample,"My window");
With this line:
gr.Window(argc,argv,mysample,"My window", &myBinReader);
Well... I learned my lesson now and next time, I'll not do so many
mistakes with passing arguments to callback-functions
Thanks a lot! The replies I got was a huge (invaluable) help to me and
I would never have sorted this out myself...