zoukankan      html  css  js  c++  java
  • 简繁字体的互相转换

    ************************************简繁字体的互相转换***********************************
    //文件名:Simplified2Traditional.h
    //
    //功能:实现繁简字体的互相转换
    //
    //作者:zngsai
    //
    //时间:2009.05.02
    *****************************************************************************************/
    /*****************************************************************************************
    //函数名:JtoF
    //功能:简体到繁体的字符串转换
    //参数1:sSrc[] - char型,简体字符串
    //参数2:nLength - unsigned long型,简体字符串长度
    //返回值:char*型,转换后的繁体字符串
    ****************************************************************************************
    */
    char* JtoF(char sSrc[],unsigned long nLength)
    {
    char* sDes = new char[nLength];
    LCMapString(MAKELCID(MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED),SORT_CHINESE_PRC),
    LCMAP_TRADITIONAL_CHINESE,(LPCTSTR)sSrc,nLength,sDes,nLength);
    //此API可将简体转化为繁体

    return sDes;
    }
    /*****************************************************************************************
    //函数名:FtoJ
    //功能:繁体到简体的字符串转换
    //参数1:sSrc[] - char型,繁体字符串
    //参数2:nLength - unsigned long型,繁体字符串长度
    //返回值:char*型,转换后的简体字符串
    ****************************************************************************************
    */
    char* FtoJ(char sSrc[],unsigned long nLength)
    {
    char* sDes = new char[nLength];
    LCMapString(MAKELCID(MAKELANGID(LANG_CHINESE,SUBLANG_CHINESE_SIMPLIFIED),SORT_CHINESE_PRC),
    LCMAP_SIMPLIFIED_CHINESE,(LPCTSTR)sSrc,nLength,sDes,nLength);
    //此API可将繁体转化为简体

    return sDes;
    }
    /*****************************************************************************************
    //函数名:File_JtoF
    //功能:简体到繁体的文本转换
    //参数:lpszFileName - LPCTSTR型,简体字符文本
    //返回值:BOOL型,返回TRUE表示转换成功,FALSE表示失败
    ****************************************************************************************
    */
    BOOL File_JtoF(LPCTSTR lpszFileName)
    {
    CFile
    * pFile;
    DWORD nFileaLen;
    char* pData;
    pFile 
    = new CFile;
    if(!pFile->Open(lpszFileName,CFile::shareDenyNone|CFile::modeReadWrite))
    return FALSE;

    nFileaLen 
    = pFile->GetLength();
    pData 
    = new char[nFileaLen];

    pFile
    ->SeekToBegin();
    pFile
    ->Read(pData,nFileaLen);

    pData 
    = JtoF(pData,nFileaLen);

    pFile
    ->SeekToBegin();
    pFile
    ->Write(pData,nFileaLen);

    return TRUE;
    }
    /*****************************************************************************************
    //函数名:File_FtoJ
    //功能:繁体到简体的文本转换
    //参数:lpszFileName - LPCTSTR型,繁体字符文本
    //返回值:BOOL型,返回TRUE表示转换成功,FALSE表示失败
    ****************************************************************************************
    */
    BOOL File_FtoJ(LPCTSTR lpszFileName)
    {
    CFile
    * pFile;
    DWORD nFileaLen;
    char* pData;
    pFile 
    = new CFile;
    if(!pFile->Open(lpszFileName,CFile::shareDenyNone|CFile::modeReadWrite))
    return FALSE;

    nFileaLen 
    = pFile->GetLength();
    pData 
    = new char[nFileaLen];

    pFile
    ->SeekToBegin();
    pFile
    ->Read(pData,nFileaLen);

    pData 
    = FtoJ(pData,nFileaLen);

    pFile
    ->SeekToBegin();
    pFile
    ->Write(pData,nFileaLen);

    return TRUE;


  • 相关阅读:
    程序员眼里IE浏览器是什么样的
    iOS UITableView 与 UITableViewController
    iOS 委托与文本输入(内容根据iOS编程编写)
    iOS 视图控制器 (内容根据iOS编程编写)
    iOS 视图:重绘与UIScrollView(内容根据iOS编程编写)
    Python_Day_05 计数器(counter),有序字典(OrderDict),默认字典(defaultdict),可命名元祖(namedtuple),双向队列(deque),单项队列(deuqe.Queue)
    iOS 视图与视图层次结构(内容根据iOS编程)
    Python_Day_04 set方法总结
    iOS通过ARC管理内存(内容根据iOS编程编写)
    Python_Day_03 list,dic,tuple方法总结
  • 原文地址:https://www.cnblogs.com/tt_mc/p/1674266.html
Copyright © 2011-2022 走看看