Jun 30th, 2001, 02:29 PM
#1
Thread Starter
Frenzied Member
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
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
Attached Files
Jun 30th, 2001, 09:46 PM
#2
Thread Starter
Frenzied Member
Never mind I got it. It worked using strcat
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width