Trying to convert a integer to CStringA! RRS feed

  • Question

  • Trying to convert a integer to CStringA.

    itoa doesnt work for me


    CStringA value;

    int number = 12453;



    itoa(int_number , value, 10);


    Error 1 error C2664: 'itoa' : cannot convert parameter 2 from 'CStringA' to 'char *' 



    Monday, January 21, 2008 4:44 PM


All replies

  • One of many ways:


    Code Block







    Monday, January 21, 2008 9:17 PM
  • As Carl says, there are many ways. You can also use GetBuffer and ReleaseBuffer of the CString or CStringA class and then you can use the buffer with itoa. It is very worthwhile to be familiar with GetBuffer and ReleaseBuffer.

    Tuesday, January 22, 2008 3:31 AM
  • i used

    Code Block





    i worked perfect!



    Tuesday, January 22, 2008 3:58 PM