Int vs Char problem

Dec 7, 2010 at 1:54am
I'm making a Sudoku game. When reading in from a file, I would like to convert all of my "0" to blank spaces. However, no matter what I do, those "blank spaces" always turn to "32" because, that's the value of a space on the ASCII Table. How do I change this? This is my code:

1
2
3
4
5
6
7
8
9
10
11
 for (int col = 0; col < 9; col++)
   {
      for (int row = 0; row < 9; row++)
      {
         fin >> sudokuBoard[row][col];
         if (sudokuBoard[row][col] == 0)
         {
            sudokuBoard[row][col] = (char)' ';
         }
      }
   }
Last edited on Dec 7, 2010 at 1:55am
Dec 7, 2010 at 2:18am
When you say you want to convert 0s to blank spaces, do you mean for display purposes?

In the array sudokuBoard, there needs to be some placeholder to represent the '0' or the 'blankspace'!
Last edited on Dec 7, 2010 at 2:20am
Topic archived. No new replies allowed.