-

   rss_forum_sources_ru

 - e-mail

 

 -

 LiveInternet.ru:
: 29.07.2007
:
:
: 80

:


TDM-GCC-64 iconv Windows

, 15 2021 . 06:23 +
mkudritsky: , !
65001 C/C++.
!

.
CP1251 Linux, Windows.
iconv.h .


tdm64-gcc-10.3.0.exe
- 64bit C/C++ Windows?
iconv.h?
, , tdm64 WINVER, (Linux Windows) :
-DWINVER

P.S. , ( txt- CP1251 ):
    #include
    #ifndef WINVER
    #include sysinfo.h>
    #else
    #include
    #endif
    #include
    #include
    // ( - RAM)
    #ifndef WINVER
    struct sysinfo osInfo;
    char cSl = '/';
    #else
    MEMORYSTATUSEX osInfo;
    char cSl = '';
    #endif
    //---------------------------------------------------------------------------
    char *Utf8ToWin(const char *cIn) {
    // cIn utf-8 cp1251
    // cp1251 utf-8
    // free()
    // ( {text})
    size_t iIn = strlen(cIn);
    //
    if (!iIn)
    return NULL;
    //
    iconv_t cd_code = iconv_open("cp1251", "utf-8");
    //
    size_t iOut = iIn, iConv;
    // , ( )
    char *cOut = (char *)calloc(iOut + 1, sizeof(char)), *cIn1 = (char *)cIn, *cOut1 = cOut;
    // /0
    memset(cOut, 0, iOut * sizeof(char));
    // utf-8 cp1251
    iConv = iconv(cd_code, &cIn1, &iIn, &cOut1, &iOut);
    //
    iconv_close(cd_code);
    if (iConv) {
    if (cOut) free(cOut);
    return NULL; //
    }
    //
    return cOut;
    }
    //---------------------------------------------------------------------------
    // sOut OS
    void PrintCons(const char* cIn) {
    char* cOut;
    if (cSl == '/')
    cOut = (char *)cIn; // Linux
    else
    cOut = Utf8ToWin(cIn); // Windows
    printf("%s", cOut);
    if (cOut && (cSl != '/'))
    free(cOut);
    }
    //---------------------------------------------------------------------------

https://forum.sources.ru/index.php?showtopic=422452&view=findpost&p=3850934

:  

: [1] []
 

:
: 

: ( )

:

  URL