title: convert int to char without itoa()
body: <p>i have a program and i should convert int to char into it</p>
  
  <p>but i cant use itoa() because site's judge don't support it</p>
  
  <p>so i wrote this:</p>
  
  <pre><code>xt[i]= rmn+'0';
  </code></pre>
  
  <p>but i get this error : </p>
  
  <pre><code>Runtime error: Illegal file open (/dev/tty) 
  </code></pre>
  
  <p>How should i convert this?</p>
  
  <p>My code is this : (for palsquare question of USACO)</p>
  
  <pre><code>/*
  ID: sa.13781
  PROG: palsquare
  LANG: C++
  */
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  
  ofstream fout("palsquare.out");
  
  int tool(char xt[])//CORRECT
  {
      int p = 0;
      while (xt[p] != 0)
          p++;
      return p;
  }
  
  void prt(char xt[])//CORRECT
  {
      int p = 0;
      while (xt[p] != 0)
      {
          fout &lt;&lt; xt[p];
          p++;
      }
  }
  
  void mabna(int a, char xt[], int mab)
  {
      int ex = 1, tavan = 0, rmn, n;
      for (; ex &lt;= a; ex *= mab)
          tavan++;
  
      for (int i = tavan - 1; a != 0; i--, a /= mab)
      {
          rmn = a % mab;
  
          switch (rmn)
          {
          case 0:
          case 1:
          case 2:
          case 3:
          case 4:
          case 5:
          case 6:
          case 7:
          case 8:
          case 9:
              xt[i] = rmn + '0';
              break;
          case 10:
              xt[i] = 'A';
              break;
          case 11:
              xt[i] = 'B';
              break;
          case 12:
              xt[i] = 'C';
              break;
          case 13:
              xt[i] = 'D';
              break;
          case 14:
              xt[i] = 'E';
              break;
          case 15:
              xt[i] = 'F';
              break;
          case 16:
              xt[i] = 'G';
              break;
          case 17:
              xt[i] = 'H';
              break;
          case 18:
              xt[i] = 'I';
              break;
          case 19:
              xt[i] = 'J';
              break;
          }
      }
  }
  
  bool mirror(char *xt)//CORRECT
  {
      int p = 0;
      int n = tool(xt);
      for (int i = 0; i &lt; (n / 2); i++)
          if (xt[i] == xt[n - i - 1])
              p++;
      if (p == (n / 2))
          return true;
      return false;
  }
  
  void calc(int mab) //CORRECT
  {
      for (int i = 1; i &lt;= 300; i++)
      {
  
          char p[10] = {0}, p2[10] = {0};
          mabna(i * i, p2, mab);
          if ( mirror(p2) == true )
          {
              mabna(i, p, mab);
              prt(p);
              fout &lt;&lt; " ";
              prt(p2);
              fout &lt;&lt; "\n";
          }
      }
  }
  
  int main()
  {
      ifstream fin("palsquare.in");
  
      int mab;
      fin &gt;&gt; mab;
      calc(mab);
  
      return 0;
  }
  </code></pre>