tags:

views:

37

answers:

1

Hey folks,

I'm currently writing a c++ program which should write me a png file as output. So I made a little code, actually works. I just took the source code from here and condesed it. My code is nopasted here.

BUT: It only works if it doesn't exceed 1002 pixels in width. I am very sure the problem is somewhere around lines 29/30, so a malloc problem, but I don't get it.

Thanks for your help & greez

+1  A: 

Without diving into the code too deeply, there are these interesting constants:

unsigned width = 1003;
unsigned height = 500;
int rowbytes = 4000;

The last one directly controls the amount of memory allocated. Have you tried increasing this value?

Starkey
nope, I'll try.
a1337q
well, was it! Thanks dude. I'll try it out, it's not actually of great importance what the relation between these vars is, not the code but the generated png is only important for me.
a1337q