Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

acessing a 1D array with row/col

Name: Anonymous 2009-04-21 8:27

imagePtr[i*cols + j]
where i and j are the row/col coordinates. this isn't right, i can't remember how else to do it. i know it's something LIKE this, just not exactly what, and google isn't cooperating. do i need to use the memory locations?

Name: Anonymous 2009-04-21 9:20

So, you're either overflowing your buffer, or your buffer is not of the right size. ( it should be of size cols*rows )
You didn't provide us enough code for us to be able to fix your problem, but fear not, as you can probably solve it yourself. Get a debugger! Run the application and see where it breaks, or set a breakpoint on the faulty line(which you already know), set a breakpoint on where you alloc the picture buffer as well, after this, such simple errors become apparent, but if that wasn't enough, you may post the full code and maybe some kind anon will help you, but you really shouldn't rely on that!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List