-
1 Attachment(s)
Strings Not Working
Okay Im making a checkers (no parksie, not "draughts", CHECKERS) game, but I'm having some trouble. All I need to do is check the board, if there is an X, then put an X onto the end of another string. I've been using sprintf but its not working, the string always comes up empty :confused:
Heres The Bulk Of The Code Thats Not Working
PHP Code:
for(i=1; i<=3; i++) {
for(a=1; a<=8; a++) {
if(a%2 == 0) {
board[i][a] = 'X';
}
if(a%2 != 0) {
board[i][a] = '_';
}
}
}
for(i=1; i<=8; i++) {
for(a=1; a<=8; a++) {
if(board[i][a] == '_') {
sprintf(FinalBoard, "_");
}
if(board[i][a]=='X') {
sprintf(FinalBoard, "X");
}
sprintf(FinalBoard, " ");
}
}
SendMessage(GameBoard, WM_SETTEXT, 0, (LPARAM) (LPCSTR) FinalBoard);
board is the board with x and y coordinates. FinalBoard is the string I want to put the X in if there is an X....if not it puts an underscore.
If it helps. here's the cpp file
-
Never mind I got it. It worked using strcat :confused: