¹ØÓÚ linux ÖÐ iconv() º¯Êý µÄÎÊÌâ
×î½üÔÚдspider ÐèÒªÒª½â¾ö ±àÂëת»» ÎÊÌâ Óõ½ iconv() º¯Êý
µ«Ò²²»ÖªµÀ ÄÄÀïÓÐÎÊÌâ ÀÏÊÇÕû²»³öÀ´ ÄÄλ´óÏÀ °ï°ïæ
´úÂë ÈçÏ£º£¨Í·Îļþû¸´ÖÆ£©
//CodeConvert.cpp
#include "CodeConvert.h"
#include "stdlib.h"
#include <string.h>
#include <errno.h>
CCodeConv::CCodeConv(const char *from_charset,const char *to_charset)
{
cd=iconv_open(to_charset,from_charset);
if( cd== (iconv_t) -1 )
{
cout < <"cannot open iconv discripter!" < <endl;
iconv_close(cd);
exit(0);
}
}
CCodeConv::~CCodeConv()
{
iconv_close(cd);
}
bool CCodeConv::Convert(char *inbuf,long inlen,char *outbuf,long outlen)
{
char **pin=&inbuf;
char **pout=&outbuf;
memset(outbuf,0,outlen);
if( -1==iconv(cd,pin,(size_t *)&inlen,pout,(size_t *)&outlen) )
{
cout < <"have error in iconv()!" < <endl;
cout < <errno < <" " < <strerror(errno) < <endl;
return false;
}
return true;
}
#include "CodeConvert.h"
#include <string.h>
int main()
{
char *in="Íõ";
Ïà¹ØÎÊ´ð£º
¸ø¸öµØÖ·£¬»òÕß·¢µ½ÎÒÓÊÏäÒ²ÐÐ wrongagain98@163.com
×îºÃÊÇÊÓÆµµÄ£¬²»ÊÇÊÓÆµÆÕͨµÄÒ²ÐС£
Ö÷ÒªÊÇÁ½·½Ã棺
1.ÔõÑù±à¼¡¢±àÒëºÍµ÷ÊÔ³ÌÐò¡£Ï£ÍûÄÜÒ»²½²½½²Çå³þ£¬ÈçºÎ°²×°¡¢ÈçºÎÅäÖõȡ£²»Òª¾Íֻ˵¾ä¡°¾ÍÓ ......
ÎÒÔÚlinuxÏÂдÁ˸öUDPµÄserverºÍclientµÄ´úÂ룬
ÏÖÔÚ³öÁËÕâÑùÒ»¸öÎÊÌ⣬
serverÊÕµ½ÁËclientµÄÊý¾Ý£¬²¢»Ø¸´ÁË£¬µ«ÊÇclientÒ»Ö±ÊÕ²»µ½server»Ø¸´µÄÄÚÈÝ£¬£¬ºóÀ´ÎÒÓÃ×¥°ü¹¤¾ß½¨Á¢ÁËÒ»¸öserverÀ´Á¬½Ó֮ǰµÄcl ......
ÎÒÒªÐÞ¸ÄÒ»¸öLinux³ÌÐòÖеÄÒ»¸ö×Ö·û´®£¬Ä¿µÄ´®±ÈÔÀ´µÄ³¤£¬ËùÒÔÖ±½ÓÌæ»»³ÌÐòÎÞ·¨ÔËÐУ¬ÒªÔõô°ì²ÅÄÜʹ³ÌÐòÕý³£ÔËÐУ¿
²»Ã÷°×ÄãÒª¸Éʲô ¸Äʲô³ÌÐò£¿
Ò»¸öÊÖ»úÉϵÄÄ£ÄâÆ÷£¬±¾À´ÊÇÔÚ/mmc/mmca1Ï´´½¨RomsÎļþ¼Ð£¬ ......
¾ÍÊÇ˵ÏÖÔÚÊÇwindowsÏ ÎÒ°ÑÒ»¸ö·ÖÇøÌÚ³öÀ´ÁË µ«ÊÇÓùâÅ̰²×°linuxµÄʱºòʶ±ð²»ÁË ÄǸÃÔõÑù°Ñ´ÅÅ̵ĸñʽת»»ÎªlinuxÄÜʶ±ð³öµÄ?
ÓÐÈËÕâÑù»Ø´ð
(
°Ñ·ÖÇøÉ¾³ý£¬È»ºóÓÃLinux°²×°Å̸ñʽ»¯³ ......
#include <fcnt1.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
int fd_open,fd_open_create,fd_create;
if((fd_open=o ......