title: How to convert gchar* to char
body: <p>When I press a key(integer) on my keyboard. It does something like:</p>
  
  <pre><code> gchar *keypressed;
   keypressed=gdk_keyval_name (event-&gt;keyval);
   printf("The KeyEvent is: %s\n", keypressed); // Till here it is fine    
  </code></pre>
  
  <p>I get segmentation fault when I do this:</p>
  
  <pre><code>char ch;
  sprintf(ch, "%s\n", keypressed);   
  printf("The NewKeyEvent is: %s\n",ch);
  </code></pre>
  
  <p>I need to <em>convert</em> it as I am going to use the value in a <em>switch case</em>. Without converting it is not possible.</p>