Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÏÂת»»×Ö·û¼¯(UTF8ת»»)£¨

  LinuxÏÂת»»×Ö·û¼¯(UTF8ת»»)£¨×ª£© ÊÕ²Ø
 ÔÚLINUXÉϽøÐбàÂëת»»Ê±,¼È¿ÉÒÔÀûÓÃiconvº¯Êý×å±à³ÌʵÏÖ,Ò²¿ÉÒÔÀûÓÃiconvÃüÁîÀ´ÊµÏÖ,Ö»²»¹ýºóÕßÊÇÕë¶ÔÎļþµÄ,¼´½«Ö¸¶¨Îļþ´ÓÒ»ÖÖ±àÂëת»»ÎªÁíÒ»ÖÖ±àÂë¡£
Ò»¡¢ÀûÓÃiconvº¯Êý×å½øÐбàÂëת»»
iconvº¯Êý×åµÄÍ·ÎļþÊÇiconv.h,ʹÓÃÇ°Ðè°üº¬Ö®¡£
#include <iconv.h>
iconvº¯Êý×åÓÐÈý¸öº¯Êý,Ô­ÐÍÈçÏÂ:
(1) iconv_t iconv_open(const char *tocode, const char *fromcode);
´Ëº¯Êý˵Ã÷½«Òª½øÐÐÄÄÁ½ÖÖ±àÂëµÄת»»,tocodeÊÇÄ¿±ê±àÂë,fromcodeÊÇÔ­±àÂë,¸Ãº¯Êý·µ»ØÒ»¸öת»»¾ä±ú,¹©ÒÔÏÂÁ½¸öº¯ÊýʹÓá£
(2) size_t iconv(iconv_t cd,char **inbuf,size_t *inbytesleft,char **outbuf,size_t *outbytesleft);
´Ëº¯Êý´ÓinbufÖжÁÈ¡×Ö·û,ת»»ºóÊä³öµ½outbufÖÐ,inbytesleftÓÃÒԼǼ»¹Î´×ª»»µÄ×Ö·ûÊý,outbytesleftÓÃÒԼǼÊä³ö»º³åµÄÊ£Óà¿Õ¼ä¡£
(3) int iconv_close(iconv_t cd);
´Ëº¯ÊýÓÃÓڹرÕת»»¾ä±ú,ÊÍ·Å×ÊÔ´¡£
Àý×Ó1: ÓÃCÓïÑÔʵÏÖµÄת»»Ê¾Àý³ÌÐò
/* f.c : ´úÂëת»»Ê¾ÀýC³ÌÐò */¾ßÌå½²£¬×Ô¼ºµÄÑé֤ʵÏÖÊǸù¾ÝÎÄÖеÄf.cʵÏÖµÄ
#include <iconv.h>
#define OUTLEN 255
main()
{
char *in_utf8 = "æ­£å?¨å??è£?";<=======´Ë×Ö·û´®Ëƺõ²¢²»ÊÇ“ÕýÔÚ°²×°”Ëĸö×ÖµÄUTF8µÄ¶ÔÕÕ´®£¬
char *in_gb2312 = "ÕýÔÚ°²×°";
char out[OUTLEN];
//unicodeÂëתΪgb2312Âë
rc = u2g(in_utf8,strlen(in_utf8),out,OUTLEN);
printf("unicode-->gb2312 out=%sn",out);
//gb2312ÂëתΪunicodeÂë
rc = g2u(in_gb2312,strlen(in_gb2312),out,OUTLEN);
printf("gb2312-->unicode out=%sn",out);
}
//´úÂëת»»:´ÓÒ»ÖÖ±àÂëתΪÁíÒ»ÖÖ±àÂë
int code_convert(char *from_charset,char *to_charset,char *inbuf,int inlen,char *outbuf,int outlen)
{
iconv_t cd;
int rc;
char **pin = &inbuf;
char **pout = &outbuf;
cd = iconv_open(to_charset,from_charset);
if (cd==0) return -1;
memset(outbuf,0,outlen);
if (iconv(cd,pin,&inlen,pout,&outlen)==-1) return -1;
iconv_close(cd);
return 0;
}
//UNICODEÂëתΪGB2312Âë
int u2g(char *inbuf,int inlen,char *outbuf,int outlen)
{
return code_convert("utf-8","gb2312",inbuf,inlen,outbuf,outlen);
}
//GB2312ÂëתΪUNICODEÂë
int g2u(char *inbuf,size_t inlen,char *outbuf,si


Ïà¹ØÎĵµ£º

ǶÈëʽlinuxÏÂQT3/EmbeddedµÄÊäÈëÉ豸Çý¶¯½Ó¿Ú

Ò»¡¢Qt3/EmbeddedµÄÊäÈëÉ豸µÄÇý¶¯½Ó¿ÚʵÏÖÔ­Àí·ÖÎö
       1¡¢Qt3/Embedded°ÑÓëµ×²ãÓ²¼þÏà¹ØµÄÔ´Îļþͳһ·ÅÔÚsrc/embeddedĿ¼Ï£¬ËùÒÔÎÒÃÇ×îºÃÒ²°Ñ×Ô¼ºµÄÉ豸Çý¶¯½Ó¿ÚÎļþ·Åµ½´ËĿ¼¡£
2¡¢Qt/EmbeddedÖеÄÊäÈëÉ豸·ÖΪÊó±êÀàÓë¼üÅÌÀà¡£ÔÚ3.x°æ±¾ÏµÁÐÖУ¬Êó±êÉ豸µÄ³éÏó»ùÀàΪQWSMouseHandler£¬ÔÚsr ......

ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ»®

ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ»®
ARM+LINUX·Ïߣ¬Ö÷¹¥Ç¶ÈëʽLinux²Ù×÷ϵͳ¼°ÆäÉÏÓ¦ÓÃÈí¼þ¿ª·¢Ä¿±ê£º 
£¨1£© ÕÆÎÕÖ÷Á÷ǶÈëʽ΢´¦ÀíÆ÷µÄ½á¹¹ÓëÔ­Àí£¨³õ²½¶¨Îªarm9£© 
£¨2£© ±ØÐëÕÆÎÕÒ»¸öǶÈëʽ²Ù×÷ϵͳ £¨³õ²½¶¨Îªuclinux»òlinux,°æ±¾´ý¶¨£© 
£¨3£© ±ØÐëÊìϤǶÈëʽÈí¼þ¿ª·¢Á÷³Ì²¢ÖÁÉÙ×öÒ ......

linux°²×°¡¢Ð¶ÔØѹËõµÄ³ÌÐò°²×°°ü

Ê×ÏÈÏȽ«Îļþ½âѹËõ£¨ÒÔ.tar.bz2ΪÀý£©£º
tar -xjvf file.tar.bz2
ÆäËûµÄÎļþµÄ½âѹ£¬¿ÉÒԲο¼ÉÏһƪ¹ØÓÚlinuxÏÂѹËõ¡¢½âѹËõÎļþµÄÎÄÕ¡£
È»ºó½øÈëµ½½âѹºóµÄÎļþÀï
cd Ŀ¼
ÔÙ½Ó×ÅÖ´ÐÐ
./configure
ÕâÑù£¬»áÉú³ÉmakefileÎļþ
½Ó׎øÐÐÎļþµÄ±àÒë
make
ÔÙ½Ó×ÅÖ´Ðа²×°
make install
·´Ö®£¬Ð¶ÔؾÍÊÇ
make unin ......

linuxºÍunixϳ£ÓýâѹºÍѹËõÃüÁî

.tar
½â°ü£º tar xvf FileName.tar
´ò°ü£ºtar cvf FileName.tar DirName
£¨×¢£ºtarÊÇ´ò°ü£¬²»ÊÇѹËõ£¡£©
---------------------------------------------
.gz
½âѹ1£ºgunzip FileName.gz
½âѹ2£ºgzip -d FileName.gz
ѹËõ£ºgzip FileName
.tar.gz
½âѹ£ºtar zxvf FileName.tar.gz
ѹËõ£ºtar zcvf FileName.tar.g ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ