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

linuxÏÂ×Ö·û±àÂëת»»

linuxÏÂ×Ö·û±àÂëת»»
Ò»¡¢ÀûÓÃ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ÓÃÒԼǼÊä³ö»º³åµÄÊ£Óà¿Õ¼ä£¬cdÊÇiconv_open·µ»ØµÄ¾ä±ú¡£ (3) int iconv_close(iconv_t cd);
´Ëº¯ÊýÓÃÓڹرÕת»»¾ä±ú,ÊÍ·Å×ÊÔ´¡£
Àý×Ó1: ÓÃCÓïÑÔʵÏÖµÄת»»Ê¾Àý³ÌÐò
/* f.c : ´úÂëת»»Ê¾ÀýC³ÌÐò */
#include <iconv.h>
#define OUTLEN 255
main()
{
char *in_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,size_t outlen)
{
return code_convert("gb2312","utf-8",inbuf,inlen,outbuf,outlen);
}
Àý×Ó2: ÓÃC++ÓïÑÔʵÏÖµÄת»»Ê¾Àý³ÌÐò
/* f.cpp : ´úÂëת»»Ê¾ÀýC++³ÌÐò */
#include <iconv.h>
#include <iostream>
#define OUTLEN 255
using namespace std;
// ´úÂëת»»²Ù×÷Àà


Ïà¹ØÎĵµ£º

LinuxϵͳSudoÃüÁîµÄʹÓÃ˵Ã÷

“Sudo” ÊÇUnix/Linuxƽ̨ÉϵÄÒ»¸ö·Ç³£ÓÐÓõŤ¾ß£¬ËüÔÊÐíϵͳ¹ÜÀíÔ±·ÖÅä¸øÆÕͨÓû§Ò»Ð©ºÏÀíµÄ“ȨÀû”£¬ÈÃËûÃÇÖ´ÐÐһЩֻÓг¬¼¶Óû§»òÆäËûÌØÐíÓû§²ÅÄÜÍê³ÉµÄÈÎÎñ£¬±ÈÈ磺ÔËÐÐһЩÏñmount£¬halt£¬suÖ®ÀàµÄÃüÁ»òÕ߱༭һЩϵͳÅäÖÃÎļþ£¬Ïñ/etc/mtab£¬ /etc/samba/smb.confµÈ¡£ÕâÑùÒÔÀ´£ ......

LinuxÏÂSUNµÄJREÎÊÌâÈÕÖ¾ÊÕ¼¯

LinuxÏÂSUNµÄJREÎÊÌâÈÕÖ¾ÊÕ¼¯
ÔÚLinuxÏÂʹÓÃSunÌṩµÄJRE£¬µ±·¢Éúcore dumpʱ£¬Èç¹ûÈ·ÈÏÊÇÓÉJREÔì³ÉµÄ£¬Sunͨ³£ÐèÒªÄãÌṩÈÕÖ¾ÒÔ¹©·ÖÎö¡£
ͨ³£ÊÇͨ¹ýÖ´ÐÐpkgapp½Å±¾À´ÊÕ¼¯¡£¸Ã½Å±¾¿ÉÔÚsunÍøÕ¾ÉÏÏÂÔØ£¬Ãû×ÖΪSUN-GDD_pkgapp_linux_redhat.tar.gz¡£
pkgapp¹¤¾ßÐèÒªkshµÄÖ§³Ö£¬Òò´ËÈç¹ûLinuxÉÏûÓа´ÕÕksh£¬±ØÐëÏÈ°²×°²Å¿É¡ ......

LinuxÏÂMail·þÎñÆ÷¼ÜÉè Sendmail

Ò»£® °²×°Sendmail¡£
   
ÍêÈ«°²×°Red Hat Linux
9.0ʱ£¬Sendmail¾Í»á×Ô¶¯ÄÚÖ㬰汾ºÅΪ8.12.8-4¡£Èç¹ûÄ㲻ȷ¶¨LinuxÊÇ·ñÒѾ­°²×°ÓÐsendmail£¬¿ÉÒÔÊäÈëÒÔÏÂÃüÁî²é¿´£º
    [root@ahpeng root] rpm –qa  grep sendmail
   
Èç¹ûÈ·¶¨Ã»Óа²×°£¬ÇëÔÚÍ ......

LinuxϾ²Ì¬¿â.aÎļþÉú³É·½·¨


LinuxϾ²Ì¬¿â.aÉú³É
1.½«¸÷º¯Êý´úÂëËùÔÚµÄÔ´Îļþ±àÒë³ÉĿ¼Îļþ¡£ÀýÈ磬¶ÔÓÚmyfunc.c£¬¿ÉÒÔÓÃÈçÏÂÃüÁî ½«Æä±àÒë³ÉÄ¿±êÎļþ£º 
gcc -c myfunc.c 
µ±È»ÔÚÓжà¸öÔ´Îļþʱ£¬Ö»ÐèÔÚgcc ÃüÁîÐÐÖн«Æä·Ö±ðÁÐÉϾͿÉÒÔÁË¡£¾­´ËÒ»²½£¬½«Äܹ»µÃµ½¸÷Ô´ÎļþµÄÄ¿±êÎļþ¡£¶ÔÉÏÀý£¬½«µÃµ½myfunc.o
2.½«¸÷Ä¿±êÎļþÊÕ¼¯ÆðÀ´· ......

LinuxÏÂTomcat 6.0.26 °²×°

ÎÒÓõÄÊÇ fedora 12 ×Ô´ýµÄjdk 1.6 ÔÚ /usr/lib/jvm/java-1.6.0-openjdk
µÚÒ»²½£º°Ñapache-tomcat-6.0.26.tar.gz½âѹºó·Åµ½/usr/local/ÏÂÖØÃüÃûΪapache-tomcat-6.0.26
µÚ¶þ²½£ºÔÚ/etc/profileÎļþÖÐÊʵ±µÄλÖÃÌí¼ÓÈçÏ»·¾³±äÁ¿
CATALINA_HOME=/usr/local/apache-tomcat-6.0.26
CATALINA_BASE=/usr/local/apache-tomcat ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ