c×Ö·û´® - C/C++ / CÓïÑÔ
C/C++ code:
#include "stdio.h"
int main(void)
{
char s1[] ="hello";
char s2[] = "wor";
strcpy(s1+strlen(s1),s2);
puts(s1);
return 0;
}
½á¹ûΪ hellowor
ÎÒÏëÎÊÏÂstrcpy µÚÒ»¸ö²ÎÊý s1+strlen(s1)ÊÇʲô¶«Î÷£¬ Ū²»Ã÷°×ÊÇÔõôʵÏÖµÄ
Õâ¸ö²»Ðаɣ¡
char s1[] ="hello";
char s2[] = "wor";
Ê×ÏÈÄ㶨ÒåµÄ¶¼Êdz£Á¿Êý×飬²»ÄÜcopyµÄ£¡
ÔÙ¾ÍÊǼ´±ãÊÇÄÜcopy Äã s1µÄ³¤¶ÈÒ²²»¹»ÈÝÄÉ Á½¸öÖ®ºÍѽ£¡
destinationµÄµØÖ·¡£
strcpy(des,orign) ÊÇ´Óorigi¿½±´µ½des £¬ ¿½±´µÄ³¤¶ÈÊÇorginµÄÖ¸ÕëÖ¸ÏòµÄµØÖ·µ½´ÓÕâ¸öµØÖ·¿ªÊ¼ÕÒµ½µÄµÚÒ»¸ö\0¡£
s1ÕâÀï±ä³ÉÀïchar*£¬s1+strlen(s1)¾Í³ÉÁËs1µÄ×Ö·û´®Î²¡£
s1ÊÇ×Ö·û´®µÄÊ×µØÖ·...
strlen(s1)ÊÇs1µÄ³¤¶È.
ËùÒÔ¾ÍÊǽ«s2½ÓÔÚs1µÄºóÃæÁË.
ÕâÑù²»»áÕ»Òç³ö£¿¹Ö£¡
Êý×éÃûs1ÆäʵÊÇÒ»Ö¸Õ룬s1Ö¸Ïò¡°hello¡±µÄ"h"£¬¶østrlen(sl)ÊÇ·µ»Ø¡°hello¡±µÄ³¤¶È£¬
¼´strlen(s1)=5£¬¹Ês1+strlen(s1)ÊÇÖ¸Ïò¡°hello¡±ÖС°o¡±µÄÏÂһλÖá£
ËùÒÔ£ºstrcpy(s1+strlen(s1),s2);Ö»Êǽ«s2¸´ÖƵ½¡°o¡±µÄºóÃæ¡£Èç´Ë½á¹ûΪ"hellowor"¡£
LZ£¬¿ÉÒԵõ½Äã˵µÄ½á¹û£¿
s1+strlen(s1)ÊǵØÖ·°¡¡£s1±¾À´¾ÍÊÇs1Êý×éµÄ³õµØÖ·¡£ÔÙ¼ÓÉϳ¤¶È¾ÍÊÇs1µÄÄ©µØÖ·ÁË¡¢strcpyÊǸ´Öƺ¯Êý¡£²ÎÊýÊÇÖ¸Õë¡£¾ÍÊǼÌÐøÍùºóÃ渴ÖÆs2µÄÄÚÈÝ
CÓïÑÔÁé»î¶à±ä¡£¡£
Õâ¸öÎÊÌâÒÔÇ°ÎÒÎʹý¡£
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
ÈçÌ⣬C/C++ÖеÄexeclÔõôµ÷ÓÃдºÃµÄjava³ÌÐò£¬
execl("/opt/java1.5/bin/java","MyClass",NULL);
ÕâÑùµÄ²»ÐÐŶ¡£
²»»á.
ÔËÐÐjava³ÌÐò
ÕÒ¹¤¾ß²é¿´Ò»ÏÂÄǸö³ÌÐòµÄÃüÁîÐÐ
ËÑË÷Ï£ºjni ......
´ó¼ÒºÃ£º
ÎÒÏëʵÏÖ¼ì²âµ½²åÈëSD¿¨ºó×Ô¶¯½«SD¿¨¸ñʽ»¯µÄ¹¦ÄÜ£¬²»ÖªC/C++ÖÐÓÐûÓиñʽ»¯UÅ̵ĺ¯Êý£¿
ÁíÍ⣬ÎÒ²»ÏëʹÓÃSHFormatDrive£¬ÒòΪÕâ¸öº¯Êý»áµ¯³öÊÇ·ñÒª¸ñʽ»¯µÄÌáʾ¿ò£¬ÎÒÐèÒªµÄÊÇϵͳ×Ô¶¯¸ñʽ»¯£¬¶ø²Ù×÷Õß² ......
ÎÒ¸Õ°ÑÌ·ºÆÇ¿µÄµÚÈý°æµÄÊéѧÍ꣬ÎÒÖªµÀµÄÓÐC++£¬CºÍÖ¸Õë CȱÏݺÍÏÝÚå Cר¼Ò±ä³É£¬»¹ÓÐÊý¾Ý½á¹¹£¬ÎÒÏëÎÊÎÊÎÒÓ¦¸ÃÒÔʲô˳ÐòÀ´Ñ§ÄØ
CȱÏݺÍÏÝÚå Cר¼Ò±à³Ì
Êǽø½×µÄ£¬²»Óü±×Å¿´
ÖÁÓÚ
CºÍÖ¸Õë
Äã²»Àí½âÖ ......
ÈçºÎ½«Ò»¸öListBoxÖеÄÊý¾Ý´æÔÚÊý¾Ý¿âÖеÄÒ»¸ö×Ö¶ÎÏÂÃ棬²¢ÇÒÿÌõ¼Ç¼µÄ×Ö·û´®¸öÊý²»Ò»¶¨ ÒÔ¼°ÈçºÎ´ÓÊý¾Ý¿âÖжÁÈ¡¸ÃListBoxÖеÄËùÓмǼ
C/C++ code:
//´æÈëÊý¾Ý¿â
void __fastcall TForm1::Button5Click(TO ......