CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    integer 2 CString ???

    hi
    how do I convert an number stored in integer format to a CString? I need this to print Text using the CDC.TextOut function. Or is there another way to do this, e.g a TextOut that handles integers too? It certainly doesn´t work if i just put the Integer variable instead of the CString in TextOut().
    please give me some advice


  2. #2
    Join Date
    May 1999
    Location
    CA, USA
    Posts
    586

    Re: integer 2 CString ???

    int iValue = 125;

    CString szValue;

    szValue.Format("%d", iValue); // Look up help for printf

    Now use the CString object in your call to TextOut().

    Rail

    ------------
    Recording Engineer/Software Developer
    Rail Jon Rogut Software
    http://home.earthlink.net/~railro/
    [email protected]

  3. #3
    Join Date
    Jul 1999
    Posts
    18

    Re: integer 2 CString ???

    Hello,

    Try this one :

    int nNum = 10; // an int for ex.
    CString str;
    str.Format( "%d",nNum );
    // you have now str = "10";




    YEOJ


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured