Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Minor Issue

Author
Message
Charles Thompson
16
Years of Service
User Offline
Joined: 30th Jul 2008
Location:
Posted: 2nd Aug 2008 09:07
This is probably just me being stupid but here's some code..
The issue is on the method draw_board on Board.cpp for some reason y_pos is never being updated. Any thoughts?
Main.cpp-


Board.cpp-

Matrix.cpp-


Charles Thompson
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 2nd Aug 2008 18:16


The problem may be in the way you're declaring

char temp[1];

and where the variables are stored in relation to each other.

It appears that you're trying to store just one character in temp. But sprintf constructs null terminated strings. So when you invoke sprintf on temp it will write out a character IF your argument results in only one digit, though it can generate more characters and overrun your one character buffer into the storage of other variables. However, the main thing to note is that sprintf will ALWAYS terminate the string with a nul (zero) value.

IOW, try expanding your temp array to at least 2 characters but to be safe make it something like 8.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office

Login to post a reply

Server time is: 2024-11-20 17:27:28
Your offset time is: 2024-11-20 17:27:28