Free Web Site - Free Web Space and Site Hosting - Web Hosting - Internet Store and Ecommerce Solution Provider - High Speed Internet
Search the Web

Convert int to string and join two strings

VC++ (MFC) Tips :     String


 

   int pointx=0, pointy=0;
   char * strx, stry, str;

    _ltoa(point.x,strx,10);         //convert data type from long into string (char *)
    _ltoa(point.y,stry,10);
    strcpy(str,"");                       //new a string
    strcat(str,strx);                    //plus a string
    strcat(str,",");
    strcat(str,stry);

   Note: you'd better use lstrcpy, instead of strcpy. Because lstrcpy is a  Win32 function, but strcpy is a Standard CRT function!


Copyright (c) 1999 - 2001, robert han, all rigths are reserved.