您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CharToWide函数代码示例

51自学网 2021-06-01 20:10:08
  C++
这篇教程C++ CharToWide函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中CharToWide函数的典型用法代码示例。如果您正苦于以下问题:C++ CharToWide函数的具体用法?C++ CharToWide怎么用?C++ CharToWide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了CharToWide函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ArcCharToWide

// Convert archived names and comments to Unicode.// Allows user to select a code page in GUI.void ArcCharToWide(const char *Src,wchar *Dest,size_t DestSize,ACTW_ENCODING Encoding){#if defined(_WIN_ALL) // Console Windows RAR.  if (Encoding==ACTW_UTF8)    UtfToWide(Src,Dest,DestSize);  else  {    Array<char> NameA;    if (Encoding==ACTW_OEM)    {      NameA.Alloc(DestSize+1);      IntToExt(Src,&NameA[0],NameA.Size());      Src=&NameA[0];    }    CharToWide(Src,Dest,DestSize);  }#else // RAR for Unix.  if (Encoding==ACTW_UTF8)    UtfToWide(Src,Dest,DestSize);  else    CharToWide(Src,Dest,DestSize);#endif  // Ensure that we return a zero terminate string for security reason.  // While [Jni]CharToWide might already do it, be protected in case of future  // changes in these functions.  if (DestSize>0)    Dest[DestSize-1]=0;}
开发者ID:sina-ht,项目名称:enfle,代码行数:30,


示例2: TestIconv

static void TestIconv(const Stroka& utf8, const Stroka& other, ECharset enc) {    Wtroka wide0 = CharToWide(utf8, CODES_UTF8);    Wtroka wide1 = CharToWide(other, enc);    UNIT_ASSERT(wide0 == wide1);    Stroka temp = WideToChar(wide0, CODES_UTF8);    UNIT_ASSERT(temp == utf8);    temp = WideToChar(wide0, enc);    UNIT_ASSERT(temp == other);    temp = Recode(enc, CODES_UTF8, other);    UNIT_ASSERT(temp == utf8);    temp = Recode(CODES_UTF8, enc, utf8);    UNIT_ASSERT(temp == other);    size_t read = 0;    size_t written = 0;    RECODE_RESULT res = RecodeToUnicode(enc, other.c_str(), wide1.begin(), other.size(), wide1.size(), read, written);    UNIT_ASSERT(res == RECODE_OK);    UNIT_ASSERT(read == other.size());    UNIT_ASSERT(written == wide1.size());    UNIT_ASSERT(wide0 == wide1);    res = RecodeFromUnicode(enc, wide0.c_str(), temp.begin(), wide0.size(), temp.size(), read, written);    UNIT_ASSERT(res == RECODE_OK);    UNIT_ASSERT(read == wide0.size());    UNIT_ASSERT(written == other.size());    UNIT_ASSERT(temp == other);}
开发者ID:Mirocow,项目名称:balancer,代码行数:33,


示例3: ConvertNameToFull

void ConvertNameToFull(const wchar *Src,wchar *Dest){  if (Src==NULL || *Src==0)  {    *Dest=0;    return;  }#ifdef _WIN_32  if (WinNT())  {    wchar FullName[NM],*NamePtr;    if (GetFullPathNameW(Src,sizeof(FullName)/sizeof(FullName[0]),FullName,&NamePtr))      strcpyw(Dest,FullName);    else      if (Src!=Dest)        strcpyw(Dest,Src);  }  else  {    char AnsiName[NM];    WideToChar(Src,AnsiName);    ConvertNameToFull(AnsiName,AnsiName);    CharToWide(AnsiName,Dest);  }#else  char AnsiName[NM];  WideToChar(Src,AnsiName);  ConvertNameToFull(AnsiName,AnsiName);  CharToWide(AnsiName,Dest);#endif}
开发者ID:zachberger,项目名称:UnRarX,代码行数:31,


示例4: ToString

void CDocListRetrieverFromDisc::FillDocInfo(SDocumentAttribtes& attrs){    Stroka strFilePath = m_SmartFileFind.GetFoundFilePath(m_iCurPath);    Stroka strURL;    if (strFilePath == m_strSearchDir) {        TStringBuf left, right;        PathHelper::Split(strFilePath, left, right);        strURL = ToString(right);    } else        strURL = strFilePath.substr(m_strSearchDir.size());    if (strURL.empty())        ythrow yexception() << "Can't build url for file /"" << strFilePath                              << "/" with searchdir /"" << m_strSearchDir << "/".";    TransformBackSlash(strURL);    attrs.m_strUrl = strURL;    Stroka strTime;    if (stroka(m_strLTM) == "file") {        CTime lw_time = m_SmartFileFind.GetFoundFileInfo(m_iCurPath).m_LastWriteTime;        strTime = lw_time.Format("%d.%m.%Y %H:%M:%S");    }    if (strTime.empty())        strTime = m_strStartTime;    attrs.m_strTitle = CharToWide(strTime);    attrs.m_strSource = strURL;    attrs.m_strTitle = CharToWide(attrs.m_strSource);     // ??? rewriting}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:33,


示例5: return

int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType){  if (strlen(NewLhd.FileName)>=NM || wcslen(NewLhd.FileNameW)>=NM)    return(0);  bool Dir=(NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY;  if (ExclCheck(NewLhd.FileName,Dir,false,true))    return(0);#ifndef SFX_MODULE  if (TimeCheck(NewLhd.mtime))    return(0);  if ((NewLhd.FileAttr & ExclFileAttr)!=0 || InclAttrSet && (NewLhd.FileAttr & InclFileAttr)==0)    return(0);  if (!Dir && SizeCheck(NewLhd.FullUnpSize))    return(0);#endif  char *ArgName;  wchar *ArgNameW;  FileArgs->Rewind();  for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++)  {#ifndef SFX_MODULE    bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL && *ArgNameW!=0;    if (Unicode)    {      wchar NameW[NM],ArgW[NM],*NamePtr=NewLhd.FileNameW;      bool CorrectUnicode=true;      if (ArgNameW==NULL || *ArgNameW==0)      {        if (!CharToWide(ArgName,ArgW) || *ArgW==0)          CorrectUnicode=false;        ArgNameW=ArgW;      }      if ((NewLhd.Flags & LHD_UNICODE)==0)      {        if (!CharToWide(NewLhd.FileName,NameW) || *NameW==0)          CorrectUnicode=false;        NamePtr=NameW;      }      if (CmpName(ArgNameW,NamePtr,MatchType))      {        if (ExactMatch!=NULL)          *ExactMatch=wcsicompc(ArgNameW,NamePtr)==0;        return(StringCount);      }      if (CorrectUnicode)        continue;    }#endif    if (CmpName(ArgName,NewLhd.FileName,MatchType))    {      if (ExactMatch!=NULL)        *ExactMatch=stricompc(ArgName,NewLhd.FileName)==0;      return(StringCount);    }  }  return(0);}
开发者ID:DreamingPiggy,项目名称:xreader-hg,代码行数:57,


示例6: return

int CommandData::IsProcessFile(FileHeader &NewLhd,bool *ExactMatch,int MatchType){  if (strlen(NewLhd.FileName)>=NM || strlenw(NewLhd.FileNameW)>=NM)    return(0);  if (ExclCheck(NewLhd.FileName,false))    return(0);#ifndef SFX_MODULE  if (TimeCheck(NewLhd.mtime))    return(0);#endif  char *ArgName;  wchar *ArgNameW;  FileArgs->Rewind();  for (int StringCount=1;FileArgs->GetString(&ArgName,&ArgNameW);StringCount++)  {#ifndef SFX_MODULE    bool Unicode=(NewLhd.Flags & LHD_UNICODE) || ArgNameW!=NULL;    if (Unicode)    {      wchar NameW[NM],ArgW[NM],*NamePtr=NewLhd.FileNameW;      if (ArgNameW==NULL)      {        CharToWide(ArgName,ArgW);        ArgNameW=ArgW;      }      if ((NewLhd.Flags & LHD_UNICODE)==0)      {        CharToWide(NewLhd.FileName,NameW);        NamePtr=NameW;      }      if (CmpName(ArgNameW,NamePtr,MatchType))      {        if (ExactMatch!=NULL)          *ExactMatch=stricompcw(ArgNameW,NamePtr)==0;        return(StringCount);      }      continue;    }#endif    if (CmpName(ArgName,NewLhd.FileName,MatchType))    {      if (ExactMatch!=NULL)        *ExactMatch=stricompc(ArgName,NewLhd.FileName)==0;      return(StringCount);    }  }  return(0);}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:48,


示例7: MakeNameUsable

void MakeNameUsable(char *Name,bool Extended){#ifdef _WIN_ALL  // In Windows we also need to convert characters not defined in current  // code page. This double conversion changes them to '?', which is  // catched by code below.  size_t NameLength=strlen(Name);  wchar NameW[NM];  CharToWide(Name,NameW,ASIZE(NameW));  WideToChar(NameW,Name,NameLength+1);  Name[NameLength]=0;#endif  for (char *s=Name;*s!=0;s=charnext(s))  {    if (strchr(Extended ? "?*<>|/"":"?*",*s)!=NULL || Extended && (byte)*s<32)      *s='_';#ifdef _EMX    if (*s=='=')      *s='_';#endif#ifndef _UNIX    if (s-Name>1 && *s==':')      *s='_';    // Remove ' ' and '.' before path separator, but allow ./ and ../.    if ((*s==' ' || *s=='.' && s>Name && !IsPathDiv(s[-1]) && s[-1]!='.') && IsPathDiv(s[1]))      *s='_';#endif  }}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:29,


示例8: getWord

bool CSentence::GetWSLemmaString(Wtroka& sLemmas, const CWordSequence& ws, bool bLem) const{    sLemmas = ws.GetCapitalizedLemma();    if (bLem)        return !sLemmas.empty();    if (sLemmas.empty())        for (int j = ws.FirstWord(); j <= ws.LastWord(); j++) {            if (!sLemmas.empty())                sLemmas += ' ';            sLemmas += getWord(j)->GetOriginalText();        }    static const Wtroka trim_chars = CharToWide(" /"/'");    TWtringBuf res = sLemmas;    while (!res.empty() && trim_chars.find(res[0]) != TWtringBuf::npos)        res.Skip(1);    while (!res.empty() && trim_chars.find(res.back()) != TWtringBuf::npos)        res.Chop(1);    if (sLemmas.size() != res.size())        sLemmas = ::ToWtring(res);    return true;}
开发者ID:dubrousky,项目名称:tomita-parser,代码行数:26,


示例9: strcpy

void FindFile::SetMask(const char *FindMask){  strcpy(FindFile::FindMask,FindMask);  if (*FindMaskW==0)    CharToWide(FindMask,FindMaskW);  FirstCall=true;}
开发者ID:LubosD,项目名称:fatrat-unpack,代码行数:7,


示例10: AddError

bool TParserBase::RecodeToUtf8(Stroka& text){    if (Encoding == CODES_UNKNOWN) {        if (!IsStringASCII(~text, ~text + +text)) {            AddError(Substitute("Unknown encoding: /"$0/".", text));            return false;        }    } else if (Encoding == CODES_UTF8) {        if (!IsUtf(text)) {            AddError(Substitute("Invalid utf8: /"$0/".", text));            return false;        }    } else {        try {            CharToWide(text, RecodeBuffer, Encoding);            WideToUTF8(RecodeBuffer, text);        } catch (yexception&) {            AddError(Substitute("Cannot recode from $0 to utf8: /"$1/".", NameByCharset(Encoding), text));            return false;        }    }    return true;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:26,


示例11: return

bool FindFile::FastFind(const char *FindMask,const wchar *FindMaskW,struct FindData *fd,bool GetSymLink){  fd->Error=false;#ifndef _UNIX  if (IsWildcard(FindMask,FindMaskW))    return(false);#endif    #ifdef _WIN_32  HANDLE hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,FindMaskW,fd);  if (hFind==INVALID_HANDLE_VALUE)    return(false);  FindClose(hFind);#else  struct stat st;  if (GetSymLink)  {#ifdef SAVE_LINKS    if (lstat(FindMask,&st)!=0)#else    if (stat(FindMask,&st)!=0)#endif    {      fd->Error=(errno!=ENOENT);      return(false);    }  }  else    if (stat(FindMask,&st)!=0)    {      fd->Error=(errno!=ENOENT);      return(false);    }#ifdef _DJGPP  fd->FileAttr=_chmod(FindMask,0);#elif defined(_EMX)  fd->FileAttr=st.st_attr;#else  fd->FileAttr=st.st_mode;#endif  fd->IsDir=IsDir(st.st_mode);  fd->Size=st.st_size;  fd->mtime=st.st_mtime;  fd->atime=st.st_atime;  fd->ctime=st.st_ctime;  fd->FileTime=fd->mtime.GetDos();  strcpy(fd->Name,FindMask);  *fd->NameW=0;#ifdef _APPLE  if (!LowAscii(fd->Name))    UtfToWide(fd->Name,fd->NameW,sizeof(fd->NameW));#elif defined(UNICODE_SUPPORTED)  if (!LowAscii(fd->Name) && UnicodeEnabled())    CharToWide(fd->Name,fd->NameW);#endif#endif  fd->Flags=0;  fd->IsDir=IsDir(fd->FileAttr);  return(true);}
开发者ID:LubosD,项目名称:fatrat-unpack,代码行数:60,


示例12: return

size_t Archive::ReadCommentData(Array<byte> *CmtData,Array<wchar> *CmtDataW){  bool Unicode=SubHead.SubFlags & SUBHEAD_FLAGS_CMT_UNICODE;  if (!ReadSubData(CmtData,NULL))    return(0);  size_t CmtSize=CmtData->Size();  if (Unicode)  {    CmtSize/=2;    Array<wchar> DataW(CmtSize+1);    RawToWide(CmtData->Addr(),DataW.Addr(),CmtSize);    DataW[CmtSize]=0;    size_t DestSize=CmtSize*4;    CmtData->Alloc(DestSize+1);    WideToChar(DataW.Addr(),(char *)CmtData->Addr(),DestSize);    (*CmtData)[DestSize]=0;    CmtSize=strlen((char *)CmtData->Addr());    CmtData->Alloc(CmtSize);    if (CmtDataW!=NULL)    {      *CmtDataW=DataW;      CmtDataW->Alloc(CmtSize);    }  }  else    if (CmtDataW!=NULL)    {      CmtData->Push(0);      CmtDataW->Alloc(CmtSize+1);      CharToWide((char *)CmtData->Addr(),CmtDataW->Addr(),CmtSize+1);      CmtData->Alloc(CmtSize);      CmtDataW->Alloc(wcslen(CmtDataW->Addr()));    }  return(CmtSize);}
开发者ID:php,项目名称:pecl-file_formats-rar,代码行数:35,


示例13: GetPasswordText

static void GetPasswordText(wchar *Str,uint MaxLength){  if (MaxLength==0)    return;#ifdef _WIN_ALL  HANDLE hConIn=GetStdHandle(STD_INPUT_HANDLE);  HANDLE hConOut=GetStdHandle(STD_OUTPUT_HANDLE);  DWORD ConInMode,ConOutMode;  DWORD Read=0;  GetConsoleMode(hConIn,&ConInMode);  GetConsoleMode(hConOut,&ConOutMode);  SetConsoleMode(hConIn,ENABLE_LINE_INPUT);  SetConsoleMode(hConOut,ENABLE_PROCESSED_OUTPUT|ENABLE_WRAP_AT_EOL_OUTPUT);  ReadConsole(hConIn,Str,MaxLength-1,&Read,NULL);  Str[Read]=0;  SetConsoleMode(hConIn,ConInMode);  SetConsoleMode(hConOut,ConOutMode);#else  char StrA[MAXPASSWORD];#if defined(_EMX) || defined (__VMS) || defined(__AROS__)  fgets(StrA,ASIZE(StrA)-1,stdin);#elif defined(__sun)  strncpyz(StrA,getpassphrase(""),ASIZE(StrA));#else  strncpyz(StrA,getpass(""),ASIZE(StrA));#endif  CharToWide(StrA,Str,MaxLength);  cleandata(StrA,sizeof(StrA));#endif  Str[MaxLength-1]=0;  RemoveLF(Str);}
开发者ID:BSzili,项目名称:aros-stuff,代码行数:33,


示例14: normalizeFQN

void  normalizeFQN(const wchar_t *source,wchar_t *dest){  char scratch[512];  WideToChar(source,scratch,512);  char temp[512];  normalizeFQN(scratch,temp);  CharToWide(temp,dest,512);}
开发者ID:jjiezheng,项目名称:arachnid,代码行数:8,


示例15: strcpy

void FindFile::SetMask(const char *FindMask){  strcpy(FindFile::FindMask,NullToEmpty(FindMask));#ifndef __BIONIC__  if (*FindMaskW==0)    CharToWide(FindMask,FindMaskW);#endif  FirstCall=true;}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:9,


示例16: CharToWide

bool CharToWide(const char *Src,wchar *Dest,size_t DestSize){  bool RetCode=true;  *Dest=0; // Set 'Dest' to zero just in case the conversion will fail.#ifdef _WIN_ALL  if (MultiByteToWideChar(CP_ACP,0,Src,-1,Dest,(int)DestSize)==0)    RetCode=false;#elif defined(_APPLE)  UtfToWide(Src,Dest,DestSize);#elif defined(MBFUNCTIONS)  size_t ResultingSize=mbstowcs(Dest,Src,DestSize);  if (ResultingSize==(size_t)-1)    RetCode=false;  if (ResultingSize==0 && *Src!=0)    RetCode=false;  if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlen(Src)<NM)  {    /* Workaround for strange Linux Unicode functions bug.       Some of wcstombs and mbstowcs implementations in some situations       (we are yet to find out what it depends on) can return an empty       string and success code if buffer size value is too large.    */    return(CharToWide(Src,Dest,NM));  }#else  if (UnicodeEnabled())  {#if defined(_EMX) && !defined(_DJGPP)    int len=Min(strlen(Src)+1,DestSize-1);    if (uni_toucs((char*)Src,len,(UniChar*)Dest,(size_t*)&DestSize)==-1 ||        DestSize>len)      DestSize=0;    RetCode=false;#endif  }  else    for (int I=0;I<DestSize;I++)    {      Dest[I]=(wchar_t)Src[I];      if (Src[I]==0)        break;    }#endif  // We tried to return the zero terminated string if conversion is failed,  // but it does not work well. MultiByteToWideChar returns 'failed' code  // even if we wanted to convert only a part of string and passed DestSize  // smaller than required for fully converted string. Such call is the valid  // behavior in RAR code and we do not expect the empty string in this case.  return(RetCode);}
开发者ID:artifexor,项目名称:stream-unrar,代码行数:56,


示例17: EnvStrW

void CommandData::ParseEnvVar(){  char *EnvStr=getenv("RAR");  if (EnvStr!=NULL)  {    Array<wchar> EnvStrW(strlen(EnvStr)+1);    CharToWide(EnvStr,&EnvStrW[0],EnvStrW.Size());    ProcessSwitchesString(&EnvStrW[0]);  }}
开发者ID:abbeycode,项目名称:UnrarKit,代码行数:10,


示例18: return

bool ScanTree::PrepareMasks(){    ScanEntireDisk=false;    if (!FileMasks->GetString(CurMask,CurMaskW,sizeof(CurMask)))        return(false);    CurMask[ASIZE(CurMask)-1]=0;    CurMaskW[ASIZE(CurMaskW)-1]=0;#ifdef _WIN_32    UnixSlashToDos(CurMask);#endif    // We wish to scan entire disk if mask like c:/ is specified    // regardless of recursion mode. Use c:/*.* mask when need to scan only    // the root directory.    ScanEntireDisk=IsDiskLetter(CurMask) && IsPathDiv(CurMask[2]) && CurMask[3]==0;    char *Name=PointToName(CurMask);    if (*Name==0)        strcat(CurMask,MASKALL);    if (Name[0]=='.' && (Name[1]==0 || Name[1]=='.' && Name[2]==0))    {        AddEndSlash(CurMask);        strcat(CurMask,MASKALL);    }    SpecPathLength=Name-CurMask;//  if (SpecPathLength>1)//    SpecPathLength--;    bool WideName=(*CurMaskW!=0);    if (WideName)    {        wchar *NameW=PointToName(CurMaskW);        if (*NameW==0)            strcatw(CurMaskW,MASKALLW);        if (NameW[0]=='.' && (NameW[1]==0 || NameW[1]=='.' && NameW[2]==0))        {            AddEndSlash(CurMaskW);            strcatw(CurMaskW,MASKALLW);        }        SpecPathLengthW=NameW-CurMaskW;    }    else    {        wchar WideMask[NM];        CharToWide(CurMask,WideMask);        SpecPathLengthW=PointToName(WideMask)-WideMask;    }    Depth=0;    strcpy(OrigCurMask,CurMask);    strcpyw(OrigCurMaskW,CurMaskW);    return(true);}
开发者ID:tanbo800,项目名称:jdownloader-service,代码行数:55,


示例19: GetWideName

wchar* GetWideName(const char *Name,const wchar *NameW,wchar *DestW){  if (NameW!=NULL && *NameW!=0)  {    if (DestW!=NameW)      strcpyw(DestW,NameW);  }  else    CharToWide(Name,DestW);  return(DestW);}
开发者ID:1ibraheem,项目名称:xbmc,代码行数:11,


示例20: CharToWide

bool CWord::IsComplexWordAsDate() const//for treating dates like 11.06.07 as Words{    if (m_typ != Complex)        return false;    static const Wtroka allowed = CharToWide("-.///11234567890г");    const Wtroka& str = GetText();    return str.find_first_not_of(allowed) == Wtroka::npos;}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:11,


示例21: GetWide

const wchar* GetWide(const char *Src){  const size_t MaxLength=NM;  static __thread wchar StrTable[4][MaxLength];  static __thread uint StrNum=0;  if (++StrNum >= ASIZE(StrTable))    StrNum=0;  wchar *Str=StrTable[StrNum];  CharToWide(Src,Str,MaxLength);  Str[MaxLength-1]=0;  return(Str);}
开发者ID:ajnelson,项目名称:bulk_extractor,代码行数:12,


示例22: ExtractStreamsNew

void ExtractStreamsNew(Archive &Arc,char *FileName,wchar *FileNameW){  if (!WinNT())    return;  wchar NameW[NM];  if (FileNameW!=NULL && *FileNameW!=0)    strcpyw(NameW,FileNameW);  else    CharToWide(FileName,NameW);  wchar StreamNameW[NM+2];  if (NameW[0]!=0 && NameW[1]==0)  {    strcpyw(StreamNameW,L".//");    strcpyw(StreamNameW+2,NameW);  }  else    strcpyw(StreamNameW,NameW);  wchar *DestName=StreamNameW+strlenw(StreamNameW);  byte *SrcName=&Arc.SubHead.SubData[0];  int DestSize=Arc.SubHead.SubData.Size()/2;  if (strlenw(StreamNameW)+DestSize>=sizeof(StreamNameW)/sizeof(StreamNameW[0]))  {#if !defined(SILENT) && !defined(SFX_MODULE)    Log(Arc.FileName,St(MStreamBroken),FileName);#endif    ErrHandler.SetErrorCode(CRC_ERROR);    return;  }  RawToWide(SrcName,DestName,DestSize);  DestName[DestSize]=0;  FindData fd;  bool Found=FindFile::FastFind(FileName,FileNameW,&fd);  if (fd.FileAttr & FILE_ATTRIBUTE_READONLY)    SetFileAttr(FileName,FileNameW,fd.FileAttr & ~FILE_ATTRIBUTE_READONLY);  char StreamName[NM];  WideToChar(StreamNameW,StreamName);  File CurFile;  if (CurFile.WCreate(StreamName,StreamNameW) && Arc.ReadSubData(NULL,&CurFile))    CurFile.Close();  File HostFile;  if (Found && HostFile.Open(FileName,FileNameW,true,true))    SetFileTime(HostFile.GetHandle(),&fd.ftCreationTime,&fd.ftLastAccessTime,                &fd.ftLastWriteTime);  if (fd.FileAttr & FILE_ATTRIBUTE_READONLY)    SetFileAttr(FileName,FileNameW,fd.FileAttr);}
开发者ID:Akkarinage,项目名称:Neoncube,代码行数:52,


示例23: StW

const wchar* StW(MSGID StringId){    static wchar StrTable[8][512];    static int StrNum = 0;    if (++StrNum >= sizeof(StrTable) / sizeof(StrTable[0]))        StrNum = 0;    wchar* Str = StrTable[StrNum];    *Str = 0;    CharToWide(StringId, Str, ASIZE(StrTable[0]));    return(Str);}
开发者ID:Tyf0n,项目名称:Rar_crack,代码行数:13,


示例24: is

void TSurnamePredictor::Load(const Stroka& path, ECharset encoding){    TIFStream is(path);    TSurnameLemma lemma;    yvector<TTempForm> paradigma;    Stroka line;    yvector<TStringBuf> fields;    while (is.ReadLine(line)) {        CustomSplit(line, ' ', fields);        if (fields.ysize() < 2)            continue;        if (fields[0][0] == '-')            fields[0] = fields[0].SubStr(1);        if (fields[1][0] == '-')            fields[1] = fields[1].SubStr(1);        if (line[0] == '$') {           SaveParadigma(lemma, paradigma);           paradigma.clear();           lemma.SurnameFlex = CharToWide(fields[1], encoding);           lemma.Weight = FromString<double>(~fields[2], +fields[2]);           continue;        };        if (lemma.SurnameFlex.empty())            continue;        if (MaxSurnameSuffixLength < fields[0].size())            MaxSurnameSuffixLength = fields[0].size();        TTempForm tempForm;        tempForm.Flex = CharToWide(fields[0], encoding);        tempForm.Grammars = HumanGrammemsToGramBitSet(CharToWide(fields[1], encoding));        paradigma.push_back(tempForm);    }}
开发者ID:Frankie-666,项目名称:tomita-parser,代码行数:38,


示例25: ConvertNameToFull

void ConvertNameToFull(const wchar *Src,wchar *Dest){  if (Src==NULL || *Src==0)  {    *Dest=0;    return;  }#ifdef _WIN_32#ifndef _WIN_CE  if (WinNT())#endif  {//#ifndef _WIN_CE#if !defined(_WIN_CE) && !defined(_LINUX)    wchar FullName[NM],*NamePtr;    if (GetFullPathNameW(Src,sizeof(FullName)/sizeof(FullName[0]),FullName,&NamePtr))      strcpyw(Dest,FullName);    else#endif      if (Src!=Dest)        strcpyw(Dest,Src);  }#ifndef _WIN_CE  else  {    char AnsiName[NM];    WideToChar(Src,AnsiName);    ConvertNameToFull(AnsiName,AnsiName);    CharToWide(AnsiName,Dest);  }#endif#else  char AnsiName[NM];  WideToChar(Src,AnsiName);  ConvertNameToFull(AnsiName,AnsiName);  CharToWide(AnsiName,Dest);#endif}
开发者ID:1ibraheem,项目名称:xbmc,代码行数:38,


示例26: CharToWide

bool CharToWide(const char *Src,wchar *Dest,size_t DestSize){  bool RetCode=true;#ifdef _WIN_32  if (MultiByteToWideChar(CP_ACP,0,Src,-1,Dest,(int)DestSize)==0)    RetCode=false;#else#ifdef _APPLE  UtfToWide(Src,Dest,DestSize);#else#ifdef MBFUNCTIONS  size_t ResultingSize=mbstowcs(Dest,Src,DestSize);  if (ResultingSize==(size_t)-1)    RetCode=false;  if (ResultingSize==0 && *Src!=0)    RetCode=false;  if ((!RetCode || *Dest==0 && *Src!=0) && DestSize>NM && strlen(Src)<NM)  {    /* Workaround for strange Linux Unicode functions bug.       Some of wcstombs and mbstowcs implementations in some situations       (we are yet to find out what it depends on) can return an empty       string and success code if buffer size value is too large.    */    return(CharToWide(Src,Dest,NM));  }#else  if (UnicodeEnabled())  {#if defined(_EMX) && !defined(_DJGPP)    int len=Min(strlen(Src)+1,DestSize-1);    if (uni_toucs((char*)Src,len,(UniChar*)Dest,(size_t*)&DestSize)==-1 ||        DestSize>len)      DestSize=0;    RetCode=false;#endif  }  else    for (int I=0;I<DestSize;I++)    {      Dest[I]=(wchar_t)Src[I];      if (Src[I]==0)        break;    }#endif#endif#endif  return(RetCode);}
开发者ID:hkajcy,项目名称:xcode_tool,代码行数:50,


示例27: return

bool ScanTree::PrepareMasks(){  if (!FileMasks->GetString(CurMask,CurMaskW,sizeof(CurMask)))    return(false);  CurMask[ASIZE(CurMask)-1]=0;  CurMaskW[ASIZE(CurMaskW)-1]=0;#ifdef _WIN_32  UnixSlashToDos(CurMask);#endif  char *Name=PointToName(CurMask);  if (*Name==0)    strcat(CurMask,MASKALL);  if (Name[0]=='.' && (Name[1]==0 || Name[1]=='.' && Name[2]==0))  {    AddEndSlash(CurMask);    strcat(CurMask,MASKALL);  }  SpecPathLength=Name-CurMask;//  if (SpecPathLength>1)//    SpecPathLength--;  bool WideName=(*CurMaskW!=0);  if (WideName)  {    wchar *NameW=PointToName(CurMaskW);    if (*NameW==0)      strcatw(CurMaskW,MASKALLW);    if (NameW[0]=='.' && (NameW[1]==0 || NameW[1]=='.' && NameW[2]==0))    {      AddEndSlash(CurMaskW);      strcatw(CurMaskW,MASKALLW);    }    SpecPathLengthW=NameW-CurMaskW;  }  else  {    wchar WideMask[NM];    CharToWide(CurMask,WideMask);    SpecPathLengthW=PointToName(WideMask)-WideMask;  }  Depth=0;  strcpy(OrigCurMask,CurMask);  strcpyw(OrigCurMaskW,CurMaskW);  return(true);}
开发者ID:BlitzMaxModules,项目名称:wx.mod,代码行数:48,


示例28: while

void ErrorHandler::SysErrMsg(){#if !defined(SFX_MODULE) && !defined(SILENT)#ifdef _WIN_ALL  wchar *lpMsgBuf=NULL;  int ErrType=GetLastError();  if (ErrType!=0 && FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,              NULL,ErrType,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),              (LPTSTR)&lpMsgBuf,0,NULL))  {    wchar *CurMsg=lpMsgBuf;    while (CurMsg!=NULL)    {      while (*CurMsg=='/r' || *CurMsg=='/n')        CurMsg++;      if (*CurMsg==0)        break;      wchar *EndMsg=wcschr(CurMsg,'/r');      if (EndMsg==NULL)        EndMsg=wcschr(CurMsg,'/n');      if (EndMsg!=NULL)      {        *EndMsg=0;        EndMsg++;      }      uiMsg(UIERROR_SYSERRMSG,CurMsg);      CurMsg=EndMsg;    }  }  LocalFree( lpMsgBuf );#endif#if defined(_UNIX) || defined(_EMX)  if (errno!=0)  {    char *err=strerror(errno);    if (err!=NULL)    {      wchar Msg[1024];      CharToWide(err,Msg,ASIZE(Msg));      uiMsg(UIERROR_SYSERRMSG,Msg);    }  }#endif#endif}
开发者ID:MeiBlack,项目名称:SARUnArchiveANY,代码行数:47,


示例29: CharToOemBuffW

void CmdExtract::ConvertDosPassword(Archive &Arc,SecPassword &DestPwd){  if (Arc.Format==RARFMT15 && Arc.FileHead.HostOS==HOST_MSDOS)  {    // We need the password in OEM encoding if file was encrypted by    // native RAR/DOS (not extender based). Let's make the conversion.    wchar PlainPsw[MAXPASSWORD];    Cmd->Password.Get(PlainPsw,ASIZE(PlainPsw));    char PswA[MAXPASSWORD];    CharToOemBuffW(PlainPsw,PswA,ASIZE(PswA));    PswA[ASIZE(PswA)-1]=0;    CharToWide(PswA,PlainPsw,ASIZE(PlainPsw));    DestPwd.Set(PlainPsw);    cleandata(PlainPsw,sizeof(PlainPsw));    cleandata(PswA,sizeof(PswA));  }}
开发者ID:KastB,项目名称:OpenCPN,代码行数:17,



注:本文中的CharToWide函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ Character函数代码示例
C++ CharToOemBuffW函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。