关于 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="Íõ";
相关问答:
大家好,本人目前刚刚接触Linux。现在公司的项目需要缩减Linux的Kernel和APP部分的Code Size。目前我们使用的是Linux2.6.22.15版本,应用于ADSL Modem(家庭网关)。
1.我们产品应用是ADSL Gateway,Kernel部 ......
出现这个错误。不知道是我代码的问题还是服务器的问题。
javax.servlet.ServletException: unable to create new native thread
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageConte ......
现在的做法是,通过crontab每分钟执行一个php,这个php负责从数据库中取出邮件,然后发送
问题是,如果邮件很多,每分钟执行不完,那会造成很多php进程
能不能实现等这个php执行完了立即启动一个新的?不用cr ......
mysqladmin -u root drop 数据库名
这样删除会要求按y 确定
有没有参数加在后面 让我不用按y确认也可以删除
mysql -u root -e "drop databse 数据库名"
SQL code:
mysql> drop datab ......
#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 ......