zoukankan      html  css  js  c++  java
  • c/c++头文件_string

    string, cstring, string.h

    一、string头文件

    主要包含一些字符串转换的函数

    // sto* NARROW CONVERSIONS
    // sto* WIDE CONVERSIONS
    stoi //convert string to int
    stol //convert string to long
    stoul //convert string to unsigned long
    stoll //convert string to long long
    stoull //convert string to unsigned long long
    stof // convert string to float
    stod // convert string to double
    stold // convert string to long double

    // to_string NARROW CONVERSIONS

    // to_wstring WIDE CONVERSIONS

    inline string to_string(int _Val)   // convert int to string

    string to_string(unsigned int _Val) // convert unsigned int to string

    string to_string(long _Val) // convert long to string

    string to_string(unsigned long _Val) // convert unsigned long to string

    string to_string(_Longlong _Val) // convert long long to string

    string to_string(_ULonglong _Val) // convert unsigned long long to string

    string to_string(long double _Val) // convert long double to string

    string to_string(double _Val) // convert double to string

    string to_string(float _Val) // convert float to string

    二、头文件string.h里面包含处理字符串的函数

    三、cstring 包含了 string.h头文件

    源码:

     string:

      1 // string standard header
      2 #pragma once
      3 #ifndef _STRING_
      4 #define _STRING_
      5 #ifndef RC_INVOKED
      6 #include <iterator>
      7 
      8  #pragma pack(push,_CRT_PACKING)
      9  #pragma warning(push,3)
     10  #pragma push_macro("new")
     11  #undef new
     12 
     13  #pragma warning(disable: 4189)
     14  #pragma warning(disable: 4172)
     15 
     16 _STD_BEGIN
     17         // basic_string INSERTERS AND EXTRACTORS
     18 template<class _Elem,
     19     class _Traits,
     20     class _Alloc> inline
     21     basic_istream<_Elem, _Traits>& operator>>(
     22         basic_istream<_Elem, _Traits>&& _Istr,
     23         basic_string<_Elem, _Traits, _Alloc>& _Str)
     24     {    // extract a string
     25     typedef ctype<_Elem> _Ctype;
     26     typedef basic_istream<_Elem, _Traits> _Myis;
     27     typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
     28     typedef typename _Mystr::size_type _Mysizt;
     29 
     30     ios_base::iostate _State = ios_base::goodbit;
     31     bool _Changed = false;
     32     const typename _Myis::sentry _Ok(_Istr);
     33 
     34     if (_Ok)
     35         {    // state okay, extract characters
     36         const _Ctype& _Ctype_fac = _USE(_Istr.getloc(), _Ctype);
     37         _Str.erase();
     38 
     39         _TRY_IO_BEGIN
     40         _Mysizt _Size = 0 < _Istr.width()
     41             && (_Mysizt)_Istr.width() < _Str.max_size()
     42                 ? (_Mysizt)_Istr.width() : _Str.max_size();
     43         typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
     44 
     45         for (; 0 < _Size; --_Size, _Meta = _Istr.rdbuf()->snextc())
     46             if(_Traits::eq_int_type(_Traits::eof(), _Meta))
     47                 {    // end of file, quit
     48                 _State |= ios_base::eofbit;
     49                 break;
     50                 }
     51             else if (_Ctype_fac.is(_Ctype::space,
     52                 _Traits::to_char_type(_Meta)))
     53                 break;    // whitespace, quit
     54             else
     55                 {    // add character to string
     56                 _Str.append(1, _Traits::to_char_type(_Meta));
     57                 _Changed = true;
     58                 }
     59         _CATCH_IO_(_Istr)
     60         }
     61 
     62     _Istr.width(0);
     63     if (!_Changed)
     64         _State |= ios_base::failbit;
     65     _Istr.setstate(_State);
     66     return (_Istr);
     67     }
     68 
     69 template<class _Elem,
     70     class _Traits,
     71     class _Alloc> inline
     72     basic_istream<_Elem, _Traits>& getline(
     73         basic_istream<_Elem, _Traits>&& _Istr,
     74         basic_string<_Elem, _Traits, _Alloc>& _Str,
     75         const _Elem _Delim)
     76     {    // get characters into string, discard delimiter
     77     typedef basic_istream<_Elem, _Traits> _Myis;
     78 
     79     ios_base::iostate _State = ios_base::goodbit;
     80     bool _Changed = false;
     81     const typename _Myis::sentry _Ok(_Istr, true);
     82 
     83     if (_Ok)
     84         {    // state okay, extract characters
     85         _TRY_IO_BEGIN
     86         _Str.erase();
     87         const typename _Traits::int_type _Metadelim =
     88             _Traits::to_int_type(_Delim);
     89         typename _Traits::int_type _Meta = _Istr.rdbuf()->sgetc();
     90 
     91         for (; ; _Meta = _Istr.rdbuf()->snextc())
     92             if (_Traits::eq_int_type(_Traits::eof(), _Meta))
     93                 {    // end of file, quit
     94                 _State |= ios_base::eofbit;
     95                 break;
     96                 }
     97             else if (_Traits::eq_int_type(_Meta, _Metadelim))
     98                 {    // got a delimiter, discard it and quit
     99                 _Changed = true;
    100                 _Istr.rdbuf()->sbumpc();
    101                 break;
    102                 }
    103             else if (_Str.max_size() <= _Str.size())
    104                 {    // string too large, quit
    105                 _State |= ios_base::failbit;
    106                 break;
    107                 }
    108             else
    109                 {    // got a character, add it to string
    110                 _Str += _Traits::to_char_type(_Meta);
    111                 _Changed = true;
    112                 }
    113         _CATCH_IO_(_Istr)
    114         }
    115 
    116     if (!_Changed)
    117         _State |= ios_base::failbit;
    118     _Istr.setstate(_State);
    119     return (_Istr);
    120     }
    121 
    122 template<class _Elem,
    123     class _Traits,
    124     class _Alloc> inline
    125     basic_istream<_Elem, _Traits>& getline(
    126         basic_istream<_Elem, _Traits>&& _Istr,
    127         basic_string<_Elem, _Traits, _Alloc>& _Str)
    128     {    // get characters into string, discard newline
    129     return (getline(_Istr, _Str, _Istr.widen('
    ')));
    130     }
    131 
    132 template<class _Elem,
    133     class _Traits,
    134     class _Alloc> inline
    135     basic_istream<_Elem, _Traits>& operator>>(
    136         basic_istream<_Elem, _Traits>& _Istr,
    137         basic_string<_Elem, _Traits, _Alloc>& _Str)
    138     {    // extract a string
    139     return (_STD move(_Istr) >> _Str);
    140     }
    141 
    142 template<class _Elem,
    143     class _Traits,
    144     class _Alloc> inline
    145     basic_istream<_Elem, _Traits>& getline(
    146         basic_istream<_Elem, _Traits>& _Istr,
    147         basic_string<_Elem, _Traits, _Alloc>& _Str,
    148         const _Elem _Delim)
    149     {    // get characters into string, discard delimiter
    150     return (getline(_STD move(_Istr), _Str, _Delim));
    151     }
    152 
    153 template<class _Elem,
    154     class _Traits,
    155     class _Alloc> inline
    156     basic_istream<_Elem, _Traits>& getline(
    157         basic_istream<_Elem, _Traits>& _Istr,
    158         basic_string<_Elem, _Traits, _Alloc>& _Str)
    159     {    // get characters into string, discard newline
    160     return (getline(_STD move(_Istr), _Str, _Istr.widen('
    ')));
    161     }
    162 
    163 template<class _Elem,
    164     class _Traits,
    165     class _Alloc> inline
    166     basic_ostream<_Elem, _Traits>& operator<<(
    167         basic_ostream<_Elem, _Traits>& _Ostr,
    168         const basic_string<_Elem, _Traits, _Alloc>& _Str)
    169     {    // insert a string
    170     typedef basic_ostream<_Elem, _Traits> _Myos;
    171     typedef basic_string<_Elem, _Traits, _Alloc> _Mystr;
    172     typedef typename _Mystr::size_type _Mysizt;
    173 
    174     ios_base::iostate _State = ios_base::goodbit;
    175     _Mysizt _Size = _Str.size();
    176     _Mysizt _Pad = _Ostr.width() <= 0 || (_Mysizt)_Ostr.width() <= _Size
    177         ? 0 : (_Mysizt)_Ostr.width() - _Size;
    178     const typename _Myos::sentry _Ok(_Ostr);
    179 
    180     if (!_Ok)
    181         _State |= ios_base::badbit;
    182     else
    183         {    // state okay, insert characters
    184     _TRY_IO_BEGIN
    185         if ((_Ostr.flags() & ios_base::adjustfield) != ios_base::left)
    186             for (; 0 < _Pad; --_Pad)    // pad on left
    187                 if (_Traits::eq_int_type(_Traits::eof(),
    188                     _Ostr.rdbuf()->sputc(_Ostr.fill())))
    189                     {    // insertion failed, quit
    190                     _State |= ios_base::badbit;
    191                     break;
    192                     }
    193 
    194         if (_State == ios_base::goodbit
    195             && _Ostr.rdbuf()->sputn(_Str.c_str(), (streamsize)_Size)
    196                 != (streamsize)_Size)
    197                 _State |= ios_base::badbit;
    198         else
    199             for (; 0 < _Pad; --_Pad)    // pad on right
    200                 if (_Traits::eq_int_type(_Traits::eof(),
    201                     _Ostr.rdbuf()->sputc(_Ostr.fill())))
    202                     {    // insertion failed, quit
    203                     _State |= ios_base::badbit;
    204                     break;
    205                     }
    206         _Ostr.width(0);
    207         _CATCH_IO_(_Ostr)
    208         }
    209 
    210     _Ostr.setstate(_State);
    211     return (_Ostr);
    212     }
    213 
    214         // sto* NARROW CONVERSIONS
    215 
    216 #define _STRTO_LL    _strtoi64
    217 #define _STRTO_ULL    _strtoui64
    218 #define _STRTO_F    strtod
    219 #define _STRTO_LD    strtod
    220 
    221 #define _WCSTO_LL    _wcstoi64
    222 #define _WCSTO_ULL    _wcstoui64
    223 #define _WCSTO_F    wcstod
    224 #define _WCSTO_LD    wcstod
    225 
    226 inline int stoi(const string& _Str, size_t *_Idx = 0,
    227     int _Base = 10)
    228     {    // convert string to int
    229     const char *_Ptr = _Str.c_str();
    230     char *_Eptr;
    231     errno = 0;
    232     long _Ans = _CSTD strtol(_Ptr, &_Eptr, _Base);
    233 
    234     if (_Ptr == _Eptr)
    235         _Xinvalid_argument("invalid stoi argument");
    236     if (errno == ERANGE || _Ans < INT_MIN != INT_MAX < _Ans)
    237         _Xout_of_range("stoi argument out of range");
    238     if (_Idx != 0)
    239         *_Idx = (size_t)(_Eptr - _Ptr);
    240     return ((int)_Ans);
    241     }
    242 
    243 inline long stol(const string& _Str, size_t *_Idx = 0,
    244     int _Base = 10)
    245     {    // convert string to long
    246     const char *_Ptr = _Str.c_str();
    247     char *_Eptr;
    248     errno = 0;
    249     long _Ans = _CSTD strtol(_Ptr, &_Eptr, _Base);
    250 
    251     if (_Ptr == _Eptr)
    252         _Xinvalid_argument("invalid stol argument");
    253     if (errno == ERANGE)
    254         _Xout_of_range("stol argument out of range");
    255     if (_Idx != 0)
    256         *_Idx = (size_t)(_Eptr - _Ptr);
    257     return (_Ans);
    258     }
    259 
    260 inline unsigned long stoul(const string& _Str, size_t *_Idx = 0,
    261     int _Base = 10)
    262     {    // convert string to unsigned long
    263     const char *_Ptr = _Str.c_str();
    264     char *_Eptr;
    265     errno = 0;
    266     unsigned long _Ans = _CSTD strtoul(_Ptr, &_Eptr, _Base);
    267 
    268     if (_Ptr == _Eptr)
    269         _Xinvalid_argument("invalid stoul argument");
    270     if (errno == ERANGE)
    271         _Xout_of_range("stoul argument out of range");
    272     if (_Idx != 0)
    273         *_Idx = (size_t)(_Eptr - _Ptr);
    274     return (_Ans);
    275     }
    276 
    277 inline _Longlong stoll(const string& _Str, size_t *_Idx = 0,
    278     int _Base = 10)
    279     {    // convert string to long long
    280     const char *_Ptr = _Str.c_str();
    281     char *_Eptr;
    282     errno = 0;
    283     _Longlong _Ans = _CSTD _STRTO_LL(_Ptr, &_Eptr, _Base);
    284 
    285     if (_Ptr == _Eptr)
    286         _Xinvalid_argument("invalid stoll argument");
    287     if (errno == ERANGE)
    288         _Xout_of_range("stoll argument out of range");
    289     if (_Idx != 0)
    290         *_Idx = (size_t)(_Eptr - _Ptr);
    291     return (_Ans);
    292     }
    293 
    294 inline _ULonglong stoull(const string& _Str, size_t *_Idx = 0,
    295     int _Base = 10)
    296     {    // convert string to unsigned long long
    297     const char *_Ptr = _Str.c_str();
    298     errno = 0;
    299     char *_Eptr;
    300     _ULonglong _Ans = _CSTD _STRTO_ULL(_Ptr, &_Eptr, _Base);
    301 
    302     if (_Ptr == _Eptr)
    303         _Xinvalid_argument("invalid stoull argument");
    304     if (errno == ERANGE)
    305         _Xout_of_range("stoull argument out of range");
    306     if (_Idx != 0)
    307         *_Idx = (size_t)(_Eptr - _Ptr);
    308     return (_Ans);
    309     }
    310 
    311 inline float stof(const string& _Str, size_t *_Idx = 0)
    312     {    // convert string to float
    313     const char *_Ptr = _Str.c_str();
    314     errno = 0;
    315     char *_Eptr;
    316     float _Ans = (float)_CSTD _STRTO_F(_Ptr, &_Eptr);
    317 
    318     if (_Ptr == _Eptr)
    319         _Xinvalid_argument("invalid stof argument");
    320     if (errno == ERANGE)
    321         _Xout_of_range("stof argument out of range");
    322     if (_Idx != 0)
    323         *_Idx = (size_t)(_Eptr - _Ptr);
    324     return (_Ans);
    325     }
    326 
    327 inline double stod(const string& _Str, size_t *_Idx = 0)
    328     {    // convert string to double
    329     const char *_Ptr = _Str.c_str();
    330     errno = 0;
    331     char *_Eptr;
    332     double _Ans = _CSTD strtod(_Ptr, &_Eptr);
    333 
    334     if (_Ptr == _Eptr)
    335         _Xinvalid_argument("invalid stod argument");
    336     if (errno == ERANGE)
    337         _Xout_of_range("stod argument out of range");
    338     if (_Idx != 0)
    339         *_Idx = (size_t)(_Eptr - _Ptr);
    340     return (_Ans);
    341     }
    342 
    343 inline long double stold(const string& _Str, size_t *_Idx = 0)
    344     {    // convert string to long double
    345     const char *_Ptr = _Str.c_str();
    346     errno = 0;
    347     char *_Eptr;
    348     long double _Ans = _CSTD _STRTO_LD(_Ptr, &_Eptr);
    349 
    350     if (_Ptr == _Eptr)
    351         _Xinvalid_argument("invalid stold argument");
    352     if (errno == ERANGE)
    353         _Xout_of_range("stold argument out of range");
    354     if (_Idx != 0)
    355         *_Idx = (size_t)(_Eptr - _Ptr);
    356     return (_Ans);
    357     }
    358 
    359         // sto* WIDE CONVERSIONS
    360 inline int stoi(const wstring& _Str, size_t *_Idx = 0,
    361     int _Base = 10)
    362     {    // convert wstring to int
    363     const wchar_t *_Ptr = _Str.c_str();
    364     wchar_t *_Eptr;
    365     errno = 0;
    366     long _Ans = _CSTD wcstol(_Ptr, &_Eptr, _Base);
    367 
    368     if (_Ptr == _Eptr)
    369         _Xinvalid_argument("invalid stoi argument");
    370     if (errno == ERANGE || _Ans < INT_MIN != INT_MAX < _Ans)
    371         _Xout_of_range("stoi argument out of range");
    372     if (_Idx != 0)
    373         *_Idx = (size_t)(_Eptr - _Ptr);
    374     return ((int)_Ans);
    375     }
    376 
    377 inline long stol(const wstring& _Str, size_t *_Idx = 0,
    378     int _Base = 10)
    379     {    // convert wstring to long
    380     const wchar_t *_Ptr = _Str.c_str();
    381     wchar_t *_Eptr;
    382     errno = 0;
    383     long _Ans = _CSTD wcstol(_Ptr, &_Eptr, _Base);
    384 
    385     if (_Ptr == _Eptr)
    386         _Xinvalid_argument("invalid stol argument");
    387     if (errno == ERANGE)
    388         _Xout_of_range("stol argument out of range");
    389     if (_Idx != 0)
    390         *_Idx = (size_t)(_Eptr - _Ptr);
    391     return (_Ans);
    392     }
    393 
    394 inline unsigned long stoul(const wstring& _Str, size_t *_Idx = 0,
    395     int _Base = 10)
    396     {    // convert wstring to unsigned long
    397     const wchar_t *_Ptr = _Str.c_str();
    398     wchar_t *_Eptr;
    399     errno = 0;
    400     unsigned long _Ans = _CSTD wcstoul(_Ptr, &_Eptr, _Base);
    401 
    402     if (_Ptr == _Eptr)
    403         _Xinvalid_argument("invalid stoul argument");
    404     if (errno == ERANGE)
    405         _Xout_of_range("stoul argument out of range");
    406     if (_Idx != 0)
    407         *_Idx = (size_t)(_Eptr - _Ptr);
    408     return (_Ans);
    409     }
    410 
    411 inline _Longlong stoll(const wstring& _Str, size_t *_Idx = 0,
    412     int _Base = 10)
    413     {    // convert wstring to long long
    414     const wchar_t *_Ptr = _Str.c_str();
    415     wchar_t *_Eptr;
    416     errno = 0;
    417     _Longlong _Ans = _CSTD _WCSTO_LL(_Ptr, &_Eptr, _Base);
    418 
    419     if (_Ptr == _Eptr)
    420         _Xinvalid_argument("invalid stoll argument");
    421     if (errno == ERANGE)
    422         _Xout_of_range("stoll argument out of range");
    423     if (_Idx != 0)
    424         *_Idx = (size_t)(_Eptr - _Ptr);
    425     return (_Ans);
    426     }
    427 
    428 inline _ULonglong stoull(const wstring& _Str, size_t *_Idx = 0,
    429     int _Base = 10)
    430     {    // convert wstring to unsigned long long
    431     const wchar_t *_Ptr = _Str.c_str();
    432     errno = 0;
    433     wchar_t *_Eptr;
    434     _ULonglong _Ans = _CSTD _WCSTO_ULL(_Ptr, &_Eptr, _Base);
    435 
    436     if (_Ptr == _Eptr)
    437         _Xinvalid_argument("invalid stoull argument");
    438     if (errno == ERANGE)
    439         _Xout_of_range("stoull argument out of range");
    440     if (_Idx != 0)
    441         *_Idx = (size_t)(_Eptr - _Ptr);
    442     return (_Ans);
    443     }
    444 
    445 inline float stof(const wstring& _Str, size_t *_Idx = 0)
    446     {    // convert wstring to float
    447     const wchar_t *_Ptr = _Str.c_str();
    448     errno = 0;
    449     wchar_t *_Eptr;
    450     float _Ans = (float)_CSTD _WCSTO_F(_Ptr, &_Eptr);
    451 
    452     if (_Ptr == _Eptr)
    453         _Xinvalid_argument("invalid stof argument");
    454     if (errno == ERANGE)
    455         _Xout_of_range("stof argument out of range");
    456     if (_Idx != 0)
    457         *_Idx = (size_t)(_Eptr - _Ptr);
    458     return (_Ans);
    459     }
    460 
    461 inline double stod(const wstring& _Str, size_t *_Idx = 0)
    462     {    // convert wstring to double
    463     const wchar_t *_Ptr = _Str.c_str();
    464     errno = 0;
    465     wchar_t *_Eptr;
    466     double _Ans = _CSTD wcstod(_Ptr, &_Eptr);
    467 
    468     if (_Ptr == _Eptr)
    469         _Xinvalid_argument("invalid stod argument");
    470     if (errno == ERANGE)
    471         _Xout_of_range("stod argument out of range");
    472     if (_Idx != 0)
    473         *_Idx = (size_t)(_Eptr - _Ptr);
    474     return (_Ans);
    475     }
    476 
    477 inline long double stold(const wstring& _Str, size_t *_Idx = 0)
    478     {    // convert wstring to long double
    479     const wchar_t *_Ptr = _Str.c_str();
    480     errno = 0;
    481     wchar_t *_Eptr;
    482     long double _Ans = _CSTD _WCSTO_LD(_Ptr, &_Eptr);
    483 
    484     if (_Ptr == _Eptr)
    485         _Xinvalid_argument("invalid stold argument");
    486     if (errno == ERANGE)
    487         _Xout_of_range("stold argument out of range");
    488     if (_Idx != 0)
    489         *_Idx = (size_t)(_Eptr - _Ptr);
    490     return (_Ans);
    491     }
    492 
    493         // to_string NARROW CONVERSIONS
    494 
    495  #define _LLFMT    "%I64"
    496 
    497  #define _TOSTRING(buf, fmt, val)    
    498     sprintf_s(buf, sizeof (buf), fmt, val)
    499 
    500 inline string to_string(int _Val)
    501     {    // convert int to string
    502     char _Buf[2 * _MAX_INT_DIG];
    503 
    504     _CSTD _TOSTRING(_Buf, "%d", _Val);
    505     return (string(_Buf));
    506     }
    507 
    508 inline string to_string(unsigned int _Val)
    509     {    // convert unsigned int to string
    510     char _Buf[2 * _MAX_INT_DIG];
    511 
    512     _CSTD _TOSTRING(_Buf, "%u", _Val);
    513     return (string(_Buf));
    514     }
    515 
    516 inline string to_string(long _Val)
    517     {    // convert long to string
    518     char _Buf[2 * _MAX_INT_DIG];
    519 
    520     _CSTD _TOSTRING(_Buf, "%ld", _Val);
    521     return (string(_Buf));
    522     }
    523 
    524 inline string to_string(unsigned long _Val)
    525     {    // convert unsigned long to string
    526     char _Buf[2 * _MAX_INT_DIG];
    527 
    528     _CSTD _TOSTRING(_Buf, "%lu", _Val);
    529     return (string(_Buf));
    530     }
    531 
    532 inline string to_string(_Longlong _Val)
    533     {    // convert long long to string
    534     char _Buf[2 * _MAX_INT_DIG];
    535 
    536     _CSTD _TOSTRING(_Buf, _LLFMT "d", _Val);
    537     return (string(_Buf));
    538     }
    539 
    540 inline string to_string(_ULonglong _Val)
    541     {    // convert unsigned long long to string
    542     char _Buf[2 * _MAX_INT_DIG];
    543 
    544     _CSTD _TOSTRING(_Buf, _LLFMT "u", _Val);
    545     return (string(_Buf));
    546     }
    547 
    548 inline string to_string(long double _Val)
    549     {    // convert long double to string
    550     typedef back_insert_iterator<string> _Iter;
    551     typedef num_put<char, _Iter> _Nput;
    552     const _Nput& _Nput_fac = use_facet<_Nput>(locale());
    553     ostream _Ios((streambuf *)0);
    554     string _Str;
    555 
    556     _Ios.setf(ios_base::fixed);
    557     _Nput_fac.put(_Iter(_Str), _Ios, ' ', _Val);
    558     return (_Str);
    559     }
    560 
    561 inline string to_string(double _Val)
    562     {    // convert double to string
    563     return (to_string((long double)_Val));
    564     }
    565 
    566 inline string to_string(float _Val)
    567     {    // convert float to string
    568     return (to_string((long double)_Val));
    569     }
    570 
    571         // to_wstring WIDE CONVERSIONS
    572 
    573  #define _WLLFMT    L"%I64"
    574 
    575  #define _TOWSTRING(buf, fmt, val)    
    576     swprintf_s(buf, sizeof (buf) / sizeof (wchar_t), fmt, val)
    577 
    578 inline wstring to_wstring(int _Val)
    579     {    // convert int to wstring
    580     wchar_t _Buf[2 * _MAX_INT_DIG];
    581 
    582     _CSTD _TOWSTRING(_Buf, L"%d", _Val);
    583     return (wstring(_Buf));
    584     }
    585 
    586 inline wstring to_wstring(unsigned int _Val)
    587     {    // convert unsigned int to wstring
    588     wchar_t _Buf[2 * _MAX_INT_DIG];
    589 
    590     _CSTD _TOWSTRING(_Buf, L"%u", _Val);
    591     return (wstring(_Buf));
    592     }
    593 
    594 inline wstring to_wstring(long _Val)
    595     {    // convert long to wstring
    596     wchar_t _Buf[2 * _MAX_INT_DIG];
    597 
    598     _CSTD _TOWSTRING(_Buf, L"%ld", _Val);
    599     return (wstring(_Buf));
    600     }
    601 
    602 inline wstring to_wstring(unsigned long _Val)
    603     {    // convert unsigned long to wstring
    604     wchar_t _Buf[2 * _MAX_INT_DIG];
    605 
    606     _CSTD _TOWSTRING(_Buf, L"%lu", _Val);
    607     return (wstring(_Buf));
    608     }
    609 
    610 inline wstring to_wstring(_Longlong _Val)
    611     {    // convert long long to wstring
    612     wchar_t _Buf[2 * _MAX_INT_DIG];
    613 
    614     _CSTD _TOWSTRING(_Buf, _WLLFMT L"d", _Val);
    615     return (wstring(_Buf));
    616     }
    617 
    618 inline wstring to_wstring(_ULonglong _Val)
    619     {    // convert unsigned long long to wstring
    620     wchar_t _Buf[2 * _MAX_INT_DIG];
    621 
    622     _CSTD _TOWSTRING(_Buf, _WLLFMT L"u", _Val);
    623     return (wstring(_Buf));
    624     }
    625 
    626 inline wstring to_wstring(long double _Val)
    627     {    // convert long double to wstring
    628     typedef back_insert_iterator<wstring> _Iter;
    629     typedef num_put<wchar_t, _Iter> _Nput;
    630     const _Nput& _Nput_fac = use_facet<_Nput>(locale());
    631     ostream _Ios((streambuf *)0);
    632     wstring _Str;
    633 
    634     _Ios.setf(ios_base::fixed);
    635     _Nput_fac.put(_Iter(_Str), _Ios, L' ', _Val);
    636     return (_Str);
    637     }
    638 
    639 inline wstring to_wstring(double _Val)
    640     {    // convert double to wstring
    641     return (to_wstring((long double)_Val));
    642     }
    643 
    644 inline wstring to_wstring(float _Val)
    645     {    // convert float to wstring
    646     return (to_wstring((long double)_Val));
    647     }
    648 _STD_END
    649 
    650  #pragma pop_macro("new")
    651  #pragma warning(pop)
    652  #pragma pack(pop)
    653 #endif /* RC_INVOKED */
    654 #endif /* _STRING */
    655 
    656 /*
    657  * Copyright (c) 1992-2012 by P.J. Plauger.  ALL RIGHTS RESERVED.
    658  * Consult your license regarding permissions and restrictions.
    659 V6.00:0009 */

    string.h

      1 /***
      2 *string.h - declarations for string manipulation functions
      3 *
      4 *       Copyright (c) Microsoft Corporation. All rights reserved.
      5 *
      6 *Purpose:
      7 *       This file contains the function declarations for the string
      8 *       manipulation functions.
      9 *       [ANSI/System V]
     10 *
     11 *       [Public]
     12 *
     13 ****/
     14 
     15 #pragma once
     16 
     17 #ifndef _INC_STRING
     18 #define _INC_STRING
     19 
     20 #include <crtdefs.h>
     21 
     22 #ifdef __cplusplus
     23 extern "C" {
     24 #endif  /* __cplusplus */
     25 
     26 #ifndef _NLSCMP_DEFINED
     27 #define _NLSCMPERROR    2147483647  /* currently == INT_MAX */
     28 #define _NLSCMP_DEFINED
     29 #endif  /* _NLSCMP_DEFINED */
     30 
     31 /* Define NULL pointer value */
     32 #ifndef NULL
     33 #ifdef __cplusplus
     34 #define NULL    0
     35 #else  /* __cplusplus */
     36 #define NULL    ((void *)0)
     37 #endif  /* __cplusplus */
     38 #endif  /* NULL */
     39 
     40 /* For backwards compatibility */
     41 #define _WConst_return _CONST_RETURN
     42 
     43 /* Function prototypes */
     44 #ifndef RC_INVOKED
     45 #ifndef _CRT_MEMORY_DEFINED
     46 #define _CRT_MEMORY_DEFINED
     47 _CRTIMP void *  __cdecl _memccpy( _Out_writes_bytes_opt_(_MaxCount) void * _Dst, _In_ const void * _Src, _In_ int _Val, _In_ size_t _MaxCount);
     48 _Check_return_ _CRTIMP _CONST_RETURN void *  __cdecl memchr( _In_reads_bytes_opt_(_MaxCount) const void * _Buf , _In_ int _Val, _In_ size_t _MaxCount);
     49 _Check_return_ _CRTIMP int     __cdecl _memicmp(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size);
     50 _Check_return_ _CRTIMP int     __cdecl _memicmp_l(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size, _In_opt_ _locale_t _Locale);
     51 _Check_return_ int     __cdecl memcmp(_In_reads_bytes_(_Size) const void * _Buf1, _In_reads_bytes_(_Size) const void * _Buf2, _In_ size_t _Size);
     52 _CRT_INSECURE_DEPRECATE_MEMORY(memcpy_s)
     53 _Post_equal_to_(_Dst)
     54 _At_buffer_((unsigned char*)_Dst, _Iter_, _Size, _Post_satisfies_(((unsigned char*)_Dst)[_Iter_] == ((unsigned char*)_Src)[_Iter_]))
     55 void *  __cdecl memcpy(_Out_writes_bytes_all_(_Size) void * _Dst, _In_reads_bytes_(_Size) const void * _Src, _In_ size_t _Size);
     56 #if __STDC_WANT_SECURE_LIB__
     57 _CRTIMP errno_t  __cdecl memcpy_s(_Out_writes_bytes_to_opt_(_DstSize, _MaxCount) void * _Dst, _In_ rsize_t _DstSize, _In_reads_bytes_opt_(_MaxCount) const void * _Src, _In_ rsize_t _MaxCount);
     58 #if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY
     59 extern "C++"
     60 {
     61 #ifndef _CRT_ENABLE_IF_DEFINED
     62   #define _CRT_ENABLE_IF_DEFINED
     63     template<bool _Enable, typename _Ty>
     64     struct _CrtEnableIf;
     65 
     66     template<typename _Ty>
     67     struct _CrtEnableIf<true, _Ty>
     68     {
     69         typedef _Ty _Type;
     70     };
     71 #endif  /* _CRT_ENABLE_IF_DEFINED */
     72     template <size_t _Size, typename _DstType>
     73     inline
     74     typename _CrtEnableIf<(_Size > 1), void *>::_Type __cdecl memcpy(_DstType (&_Dst)[_Size], _In_reads_bytes_opt_(_SrcSize) const void *_Src, _In_ size_t _SrcSize) _CRT_SECURE_CPP_NOTHROW
     75     {
     76         return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize) == 0 ? _Dst : 0;
     77     }
     78 }
     79 #endif  /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY */
     80 #if defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY
     81 extern "C++"
     82 {
     83     template <size_t _Size, typename _DstType>
     84     inline
     85     errno_t __CRTDECL memcpy_s(_DstType (&_Dst)[_Size], _In_reads_bytes_opt_(_SrcSize) const void * _Src, _In_ rsize_t _SrcSize) _CRT_SECURE_CPP_NOTHROW
     86     {
     87         return memcpy_s(_Dst, _Size * sizeof(_DstType), _Src, _SrcSize);
     88     }
     89 }
     90 #endif  /* defined (__cplusplus) && _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY */
     91 #endif  /* __STDC_WANT_SECURE_LIB__ */
     92         _Post_equal_to_(_Dst)
     93         _At_buffer_((unsigned char*)_Dst, _Iter_, _Size, _Post_satisfies_(((unsigned char*)_Dst)[_Iter_] == _Val))
     94         void *  __cdecl memset(_Out_writes_bytes_all_(_Size) void * _Dst, _In_ int _Val, _In_ size_t _Size);
     95 
     96 #if !__STDC__
     97 /* Non-ANSI names for compatibility */
     98 _CRT_NONSTDC_DEPRECATE(_memccpy) _CRTIMP void * __cdecl memccpy(_Out_writes_bytes_opt_(_Size) void * _Dst, _In_reads_bytes_opt_(_Size) const void * _Src, _In_ int _Val, _In_ size_t _Size);
     99 _Check_return_ _CRT_NONSTDC_DEPRECATE(_memicmp) _CRTIMP int __cdecl memicmp(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size);
    100 #endif  /* !__STDC__ */
    101 
    102 #endif  /* _CRT_MEMORY_DEFINED */
    103 #endif  /* RC_INVOKED */
    104 
    105 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl _strset_s(_Inout_updates_z_(_DstSize) char * _Dst, _In_ size_t _DstSize, _In_ int _Value);
    106 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strset_s, _Prepost_z_ char, _Dest, _In_ int, _Value)
    107 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, _strset, _Inout_z_, char, _Dest, _In_ int, _Value)
    108 #if __STDC_WANT_SECURE_LIB__
    109 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strcpy_s(_Out_writes_z_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_z_ const char * _Src);
    110 #endif  /* __STDC_WANT_SECURE_LIB__ */
    111 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strcpy_s, _Post_z_ char, _Dest, _In_z_ const char *, _Source)
    112 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, strcpy, _Out_writes_z_(_String_length_(_Source) + 1), char, _Dest, _In_z_ const char *, _Source)
    113 #if __STDC_WANT_SECURE_LIB__
    114 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strcat_s(_Inout_updates_z_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_z_ const char * _Src);
    115 #endif  /* __STDC_WANT_SECURE_LIB__ */
    116 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strcat_s, char, _Dest, _In_z_ const char *, _Source)
    117 #ifndef RC_INVOKED
    118 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(char *, __RETURN_POLICY_DST, __EMPTY_DECLSPEC, strcat, _Inout_updates_z_(_String_length_(_Dest) + _String_length_(_Source) + 1), char, _Dest, _In_z_ const char *, _Source)
    119 #endif
    120 _Check_return_ int     __cdecl strcmp(_In_z_ const char * _Str1, _In_z_ const char * _Str2);
    121 _Check_return_ size_t  __cdecl strlen(_In_z_ const char * _Str);
    122 _Check_return_ _CRTIMP
    123 _When_(_MaxCount > _String_length_(_Str), _Post_satisfies_(return == _String_length_(_Str)))
    124 _When_(_MaxCount <= _String_length_(_Str), _Post_satisfies_(return == _MaxCount))
    125 size_t  __cdecl strnlen(_In_reads_or_z_(_MaxCount) const char * _Str, _In_ size_t _MaxCount);
    126 #if __STDC_WANT_SECURE_LIB__ && !defined (__midl)
    127 _Check_return_ static __inline
    128 _When_(_MaxCount > _String_length_(_Str), _Post_satisfies_(return == _String_length_(_Str)))
    129 _When_(_MaxCount <= _String_length_(_Str), _Post_satisfies_(return == _MaxCount))
    130 size_t  __CRTDECL strnlen_s(_In_reads_or_z_(_MaxCount) const char * _Str, _In_ size_t _MaxCount)
    131 {
    132     return (_Str==0) ? 0 : strnlen(_Str, _MaxCount);
    133 }
    134 #endif  /* __STDC_WANT_SECURE_LIB__ && !defined (__midl) */
    135 #if __STDC_WANT_SECURE_LIB__
    136 _Check_return_wat_ _CRTIMP errno_t __cdecl memmove_s(_Out_writes_bytes_to_opt_(_DstSize,_MaxCount) void * _Dst, _In_ rsize_t _DstSize, _In_reads_bytes_opt_(_MaxCount) const void * _Src, _In_ rsize_t _MaxCount);
    137 #endif  /* __STDC_WANT_SECURE_LIB__ */
    138 
    139 _CRTIMP _CRT_INSECURE_DEPRECATE_MEMORY(memmove_s) void *  __cdecl memmove(_Out_writes_bytes_all_opt_(_Size) void * _Dst, _In_reads_bytes_opt_(_Size) const void * _Src, _In_ size_t _Size);
    140 
    141 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    142 #pragma push_macro("_strdup")
    143 #undef _strdup
    144 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    145 
    146 _Check_return_ _CRTIMP char *  __cdecl _strdup(_In_opt_z_ const char * _Src);
    147 
    148 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    149 #pragma pop_macro("_strdup")
    150 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    151 
    152 _Check_return_ _CRTIMP _CONST_RETURN char *  __cdecl strchr(_In_z_ const char * _Str, _In_ int _Val);
    153 _Check_return_ _CRTIMP int     __cdecl _stricmp(_In_z_  const char * _Str1, _In_z_  const char * _Str2);
    154 _Check_return_ _CRTIMP int     __cdecl _strcmpi(_In_z_  const char * _Str1, _In_z_  const char * _Str2);
    155 _Check_return_ _CRTIMP int     __cdecl _stricmp_l(_In_z_  const char * _Str1, _In_z_  const char * _Str2, _In_opt_ _locale_t _Locale);
    156 _Check_return_ _CRTIMP int     __cdecl strcoll(_In_z_  const char * _Str1, _In_z_  const  char * _Str2);
    157 _Check_return_ _CRTIMP int     __cdecl _strcoll_l(_In_z_  const char * _Str1, _In_z_  const char * _Str2, _In_opt_ _locale_t _Locale);
    158 _Check_return_ _CRTIMP int     __cdecl _stricoll(_In_z_  const char * _Str1, _In_z_  const char * _Str2);
    159 _Check_return_ _CRTIMP int     __cdecl _stricoll_l(_In_z_  const char * _Str1, _In_z_  const char * _Str2, _In_opt_ _locale_t _Locale);
    160 _Check_return_ _CRTIMP int     __cdecl _strncoll  (_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount);
    161 _Check_return_ _CRTIMP int     __cdecl _strncoll_l(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    162 _Check_return_ _CRTIMP int     __cdecl _strnicoll (_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount);
    163 _Check_return_ _CRTIMP int     __cdecl _strnicoll_l(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    164 _Check_return_ _CRTIMP size_t  __cdecl strcspn(_In_z_  const char * _Str, _In_z_  const char * _Control);
    165 _Check_return_ _CRT_INSECURE_DEPRECATE(_strerror_s) _CRTIMP char *  __cdecl _strerror(_In_opt_z_ const char * _ErrMsg);
    166 _Check_return_wat_ _CRTIMP errno_t __cdecl _strerror_s(_Out_writes_z_(_SizeInBytes) char * _Buf, _In_ size_t _SizeInBytes, _In_opt_z_ const char * _ErrMsg);
    167 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strerror_s, char, _Buffer, _In_opt_z_ const char *, _ErrorMessage)
    168 _Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s) _CRTIMP char *  __cdecl strerror(_In_ int);
    169 #if __STDC_WANT_SECURE_LIB__
    170 _Check_return_wat_ _CRTIMP errno_t __cdecl strerror_s(_Out_writes_z_(_SizeInBytes) char * _Buf, _In_ size_t _SizeInBytes, _In_ int _ErrNum);
    171 #endif  /* __STDC_WANT_SECURE_LIB__ */
    172 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, strerror_s, char, _Buffer, _In_ int, _ErrorMessage)
    173 _Check_return_wat_ _CRTIMP errno_t __cdecl _strlwr_s(_Inout_updates_z_(_Size) char * _Str, _In_ size_t _Size);
    174 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _strlwr_s, _Prepost_z_ char, _String)
    175 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(char *, __RETURN_POLICY_DST, _CRTIMP, _strlwr, _Inout_z_, char, _String)
    176 _Check_return_wat_ _CRTIMP errno_t __cdecl _strlwr_s_l(_Inout_updates_z_(_Size) char * _Str, _In_ size_t _Size, _In_opt_ _locale_t _Locale);
    177 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strlwr_s_l, _Prepost_z_ char, _String, _In_opt_ _locale_t, _Locale)
    178 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(char *, __RETURN_POLICY_DST, _CRTIMP, _strlwr_l, _strlwr_s_l, _Inout_updates_z_(_Size) char, _Inout_z_, char, _String, _In_opt_ _locale_t, _Locale)
    179 #if __STDC_WANT_SECURE_LIB__
    180 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strncat_s(_Inout_updates_z_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_reads_or_z_(_MaxCount) const char * _Src, _In_ rsize_t _MaxCount);
    181 #endif  /* __STDC_WANT_SECURE_LIB__ */
    182 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, strncat_s, _Prepost_z_ char, _Dest, _In_reads_or_z_(_Count) const char *, _Source, _In_ size_t, _Count)
    183 #pragma warning(push)
    184 #pragma warning(disable:6059)
    185 /* prefast noise VSW 489802 */
    186 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(char *, __RETURN_POLICY_DST, _CRTIMP, strncat, strncat_s, _Inout_updates_z_(_Size) char, _Inout_updates_z_(_Count), char, _Dest, _In_reads_or_z_(_Count) const char *, _Source, _In_ size_t, _Count)
    187 #pragma warning(pop)
    188 _Check_return_ _CRTIMP int     __cdecl strncmp(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount);
    189 _Check_return_ _CRTIMP int     __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount);
    190 _Check_return_ _CRTIMP int     __cdecl _strnicmp_l(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    191 #if __STDC_WANT_SECURE_LIB__
    192 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl strncpy_s(_Out_writes_z_(_SizeInBytes) char * _Dst, _In_ rsize_t _SizeInBytes, _In_reads_or_z_(_MaxCount) const char * _Src, _In_ rsize_t _MaxCount);
    193 #endif  /* __STDC_WANT_SECURE_LIB__ */
    194 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, strncpy_s, char, _Dest, _In_reads_or_z_(_Count) const char *, _Source, _In_ size_t, _Count)
    195 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(char *, __RETURN_POLICY_DST, _CRTIMP, strncpy, strncpy_s, _Out_writes_z_(_Size) char, _Out_writes_(_Count) _Post_maybez_, char, _Dest, _In_reads_or_z_(_Count) const char *, _Source, _In_ size_t, _Count)
    196 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl _strnset_s(_Inout_updates_z_(_SizeInBytes) char * _Str, _In_ size_t _SizeInBytes, _In_ int _Val, _In_ size_t _MaxCount);
    197 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, _strnset_s, _Prepost_z_ char, _Dest, _In_ int, _Val, _In_ size_t, _Count)
    198 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(char *, __RETURN_POLICY_DST, _CRTIMP, _strnset, _strnset_s, _Inout_updates_z_(_Size) char, _Inout_updates_z_(_Count), char, _Dest, _In_ int, _Val, _In_ size_t, _Count)
    199 _Check_return_ _CRTIMP _CONST_RETURN char *  __cdecl strpbrk(_In_z_ const char * _Str, _In_z_ const char * _Control);
    200 _Check_return_ _CRTIMP _CONST_RETURN char *  __cdecl strrchr(_In_z_ const char * _Str, _In_ int _Ch);
    201 _CRTIMP char *  __cdecl _strrev(_Inout_z_ char * _Str);
    202 _Check_return_ _CRTIMP size_t  __cdecl strspn(_In_z_ const char * _Str, _In_z_ const char * _Control);
    203 _Check_return_ _Ret_maybenull_ _CRTIMP _CONST_RETURN char *  __cdecl strstr(_In_z_ const char * _Str, _In_z_ const char * _SubStr);
    204 _Check_return_ _CRT_INSECURE_DEPRECATE(strtok_s) _CRTIMP char *  __cdecl strtok(_Inout_opt_z_ char * _Str, _In_z_ const char * _Delim);
    205 #if __STDC_WANT_SECURE_LIB__
    206 _Check_return_ _CRTIMP_ALTERNATIVE char *  __cdecl strtok_s(_Inout_opt_z_ char * _Str, _In_z_ const char * _Delim, _Inout_ _Deref_prepost_opt_z_ char ** _Context);
    207 #endif  /* __STDC_WANT_SECURE_LIB__ */
    208 _Check_return_wat_ _CRTIMP errno_t __cdecl _strupr_s(_Inout_updates_z_(_Size) char * _Str, _In_ size_t _Size);
    209 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _strupr_s, _Prepost_z_ char, _String)
    210 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(char *, __RETURN_POLICY_DST, _CRTIMP, _strupr, _Inout_z_, char, _String)
    211 _Check_return_wat_ _CRTIMP errno_t __cdecl _strupr_s_l(_Inout_updates_z_(_Size) char * _Str, _In_ size_t _Size, _locale_t _Locale);
    212 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _strupr_s_l, _Prepost_z_ char, _String, _locale_t, _Locale)
    213 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(char *, __RETURN_POLICY_DST, _CRTIMP, _strupr_l, _strupr_s_l, _Inout_updates_z_(_Size) char, _Inout_z_, char, _String, _In_opt_ _locale_t, _Locale)
    214 _Check_return_opt_ _CRTIMP size_t  __cdecl strxfrm (_Out_writes_opt_(_MaxCount) _Post_maybez_ char * _Dst, _In_z_ const char * _Src, _In_ size_t _MaxCount);
    215 _Check_return_opt_ _CRTIMP size_t  __cdecl _strxfrm_l(_Out_writes_opt_(_MaxCount) _Post_maybez_ char * _Dst, _In_z_ const char * _Src, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    216 
    217 #ifdef __cplusplus
    218 extern "C++" {
    219 #ifndef _CPP_NARROW_INLINES_DEFINED
    220 #define _CPP_NARROW_INLINES_DEFINED
    221 _Check_return_ inline char * __CRTDECL strchr(_In_z_ char * _Str, _In_ int _Ch)
    222         { return (char*)strchr((const char*)_Str, _Ch); }
    223 _Check_return_ inline char * __CRTDECL strpbrk(_In_z_ char * _Str, _In_z_ const char * _Control)
    224         { return (char*)strpbrk((const char*)_Str, _Control); }
    225 _Check_return_ inline char * __CRTDECL strrchr(_In_z_ char * _Str, _In_ int _Ch)
    226         { return (char*)strrchr((const char*)_Str, _Ch); }
    227 _Check_return_ _Ret_maybenull_ inline char * __CRTDECL strstr(_In_z_ char * _Str, _In_z_ const char * _SubStr)
    228         { return (char*)strstr((const char*)_Str, _SubStr); }
    229 #endif  /* _CPP_NARROW_INLINES_DEFINED */
    230 #ifndef _CPP_MEMCHR_DEFINED
    231 #define _CPP_MEMCHR_DEFINED
    232 _Check_return_ inline void * __CRTDECL memchr(_In_reads_bytes_opt_(_N) void * _Pv, _In_ int _C, _In_ size_t _N)
    233         { return (void*)memchr((const void*)_Pv, _C, _N); }
    234 #endif  /* _CPP_MEMCHR_DEFINED */
    235 }
    236 #endif  /* __cplusplus */
    237 
    238 #if !__STDC__
    239 
    240 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    241 #pragma push_macro("strdup")
    242 #undef strdup
    243 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    244 
    245 _Check_return_ _CRT_NONSTDC_DEPRECATE(_strdup) _CRTIMP char * __cdecl strdup(_In_opt_z_ const char * _Src);
    246 
    247 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    248 #pragma pop_macro("strdup")
    249 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    250 
    251 /* prototypes for oldnames.lib functions */
    252 _Check_return_ _CRT_NONSTDC_DEPRECATE(_strcmpi) _CRTIMP int __cdecl strcmpi(_In_z_ const char * _Str1, _In_z_ const char * _Str2);
    253 _Check_return_ _CRT_NONSTDC_DEPRECATE(_stricmp) _CRTIMP int __cdecl stricmp(_In_z_ const char * _Str1, _In_z_ const char * _Str2);
    254 _CRT_NONSTDC_DEPRECATE(_strlwr) _CRTIMP char * __cdecl strlwr(_Inout_z_ char * _Str);
    255 _Check_return_ _CRT_NONSTDC_DEPRECATE(_strnicmp) _CRTIMP int __cdecl strnicmp(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str, _In_ size_t _MaxCount);
    256 _CRT_NONSTDC_DEPRECATE(_strnset) _CRTIMP char * __cdecl strnset(_Inout_updates_z_(_MaxCount) char * _Str, _In_ int _Val, _In_ size_t _MaxCount);
    257 _CRT_NONSTDC_DEPRECATE(_strrev) _CRTIMP char * __cdecl strrev(_Inout_z_ char * _Str);
    258 _CRT_NONSTDC_DEPRECATE(_strset)         char * __cdecl strset(_Inout_z_ char * _Str, _In_ int _Val);
    259 _CRT_NONSTDC_DEPRECATE(_strupr) _CRTIMP char * __cdecl strupr(_Inout_z_ char * _Str);
    260 
    261 #endif  /* !__STDC__ */
    262 
    263 
    264 #ifndef _WSTRING_DEFINED
    265 
    266 /* wide function prototypes, also declared in wchar.h  */
    267 
    268 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    269 #pragma push_macro("_wcsdup")
    270 #undef _wcsdup
    271 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    272 
    273 _Check_return_ _CRTIMP wchar_t * __cdecl _wcsdup(_In_z_ const wchar_t * _Str);
    274 
    275 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    276 #pragma pop_macro("_wcsdup")
    277 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    278 
    279 #if __STDC_WANT_SECURE_LIB__
    280 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl wcscat_s(_Inout_updates_z_(_SizeInWords) wchar_t * _Dst, _In_ rsize_t _SizeInWords, _In_z_ const wchar_t * _Src);
    281 #endif  /* __STDC_WANT_SECURE_LIB__ */
    282 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, wcscat_s, wchar_t, _Dest, _In_z_ const wchar_t *, _Source)
    283 #ifndef RC_INVOKED
    284 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, wcscat, _Inout_updates_z_(_String_length_(_Dest) + _String_length_(_Source) + 1), wchar_t, _Dest, _In_z_ const wchar_t *, _Source)
    285 #endif
    286 _Check_return_
    287 _When_(return != NULL, _Ret_range_(_Str, _Str+_String_length_(_Str)-1))
    288 _CRTIMP _CONST_RETURN wchar_t * __cdecl wcschr(_In_z_ const wchar_t * _Str, wchar_t _Ch);
    289 _Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    290 #if __STDC_WANT_SECURE_LIB__
    291 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl wcscpy_s(_Out_writes_z_(_SizeInWords) wchar_t * _Dst, _In_ rsize_t _SizeInWords, _In_z_ const wchar_t * _Src);
    292 #endif  /* __STDC_WANT_SECURE_LIB__ */
    293 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, wcscpy_s, wchar_t, _Dest, _In_z_ const wchar_t *, _Source)
    294 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, wcscpy, _Out_writes_z_(_String_length_(_Source) + 1), wchar_t, _Dest, _In_z_ const wchar_t *, _Source)
    295 _Check_return_ _CRTIMP size_t __cdecl wcscspn(_In_z_ const wchar_t * _Str, _In_z_ const wchar_t * _Control);
    296 _Check_return_ _CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t * _Str);
    297 _Check_return_ _CRTIMP
    298 _When_(_MaxCount > _String_length_(_Src), _Post_satisfies_(return == _String_length_(_Src)))
    299 _When_(_MaxCount <= _String_length_(_Src), _Post_satisfies_(return == _MaxCount))
    300 size_t __cdecl wcsnlen(_In_reads_or_z_(_MaxCount) const wchar_t * _Src, _In_ size_t _MaxCount);
    301 #if __STDC_WANT_SECURE_LIB__ && !defined (__midl)
    302 _Check_return_ static __inline
    303 _When_(_MaxCount > _String_length_(_Src), _Post_satisfies_(return == _String_length_(_Src)))
    304 _When_(_MaxCount <= _String_length_(_Src), _Post_satisfies_(return == _MaxCount))
    305 size_t __CRTDECL wcsnlen_s(_In_reads_or_z_(_MaxCount) const wchar_t * _Src, _In_ size_t _MaxCount)
    306 {
    307     return (_Src == NULL) ? 0 : wcsnlen(_Src, _MaxCount);
    308 }
    309 #endif  /* __STDC_WANT_SECURE_LIB__ && !defined (__midl) */
    310 #if __STDC_WANT_SECURE_LIB__
    311 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl wcsncat_s(_Inout_updates_z_(_SizeInWords) wchar_t * _Dst, _In_ rsize_t _SizeInWords, _In_reads_or_z_(_MaxCount) const wchar_t * _Src, _In_ rsize_t _MaxCount);
    312 #endif  /* __STDC_WANT_SECURE_LIB__ */
    313 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, wcsncat_s, _Prepost_z_ wchar_t, _Dest, _In_reads_or_z_(_Count) const wchar_t *, _Source, _In_ size_t, _Count)
    314 #pragma warning(push)
    315 #pragma warning(disable:6059)
    316 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, wcsncat, wcsncat_s, _Inout_updates_z_(_Size) wchar_t, _Inout_updates_z_(_Count), wchar_t, _Dest, _In_reads_or_z_(_Count) const wchar_t *, _Source, _In_ size_t, _Count)
    317 #pragma warning(pop)
    318 _Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount);
    319 #if __STDC_WANT_SECURE_LIB__
    320 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl wcsncpy_s(_Out_writes_z_(_SizeInWords) wchar_t * _Dst, _In_ rsize_t _SizeInWords, _In_reads_or_z_(_MaxCount) const wchar_t * _Src, _In_ rsize_t _MaxCount);
    321 #endif  /* __STDC_WANT_SECURE_LIB__ */
    322 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, wcsncpy_s, wchar_t, _Dest, _In_reads_or_z_(_Count) const wchar_t *, _Source, _In_ size_t, _Count)
    323 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, wcsncpy, wcsncpy_s, _Pre_notnull_ _Post_maybez_ wchar_t, _Out_writes_(_Count) _Post_maybez_, wchar_t, _Dest, _In_reads_or_z_(_Count) const wchar_t *, _Source, _In_ size_t, _Count)
    324 _Check_return_ _CRTIMP _CONST_RETURN wchar_t * __cdecl wcspbrk(_In_z_ const wchar_t * _Str, _In_z_ const wchar_t * _Control);
    325 _Check_return_ _CRTIMP _CONST_RETURN wchar_t * __cdecl wcsrchr(_In_z_ const wchar_t * _Str, _In_ wchar_t _Ch);
    326 _Check_return_ _CRTIMP size_t __cdecl wcsspn(_In_z_ const wchar_t * _Str, _In_z_ const wchar_t * _Control);
    327 _Check_return_ _Ret_maybenull_
    328 _When_(return != NULL, _Ret_range_(_Str, _Str+_String_length_(_Str)-1))
    329 _CRTIMP _CONST_RETURN wchar_t * __cdecl wcsstr(_In_z_ const wchar_t * _Str, _In_z_ const wchar_t * _SubStr);
    330 _Check_return_ _CRT_INSECURE_DEPRECATE(wcstok_s) _CRTIMP wchar_t * __cdecl wcstok(_Inout_opt_z_ wchar_t * _Str, _In_z_ const wchar_t * _Delim);
    331 #if __STDC_WANT_SECURE_LIB__
    332 _Check_return_ _CRTIMP_ALTERNATIVE wchar_t * __cdecl wcstok_s(_Inout_opt_z_ wchar_t * _Str, _In_z_ const wchar_t * _Delim, _Inout_ _Deref_prepost_opt_z_ wchar_t ** _Context);
    333 #endif  /* __STDC_WANT_SECURE_LIB__ */
    334 _Check_return_ _CRT_INSECURE_DEPRECATE(_wcserror_s) _CRTIMP wchar_t * __cdecl _wcserror(_In_ int _ErrNum);
    335 _Check_return_wat_ _CRTIMP errno_t __cdecl _wcserror_s(_Out_writes_opt_z_(_SizeInWords) wchar_t * _Buf, _In_ size_t _SizeInWords, _In_ int _ErrNum);
    336 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wcserror_s, wchar_t, _Buffer, _In_ int, _Error)
    337 _Check_return_ _CRT_INSECURE_DEPRECATE(__wcserror_s) _CRTIMP wchar_t * __cdecl __wcserror(_In_opt_z_ const wchar_t * _Str);
    338 _Check_return_wat_ _CRTIMP errno_t __cdecl __wcserror_s(_Out_writes_opt_z_(_SizeInWords) wchar_t * _Buffer, _In_ size_t _SizeInWords, _In_z_ const wchar_t * _ErrMsg);
    339 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, __wcserror_s, wchar_t, _Buffer, _In_z_ const wchar_t *, _ErrorMessage)
    340 
    341 _Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    342 _Check_return_ _CRTIMP int __cdecl _wcsicmp_l(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2, _In_opt_ _locale_t _Locale);
    343 _Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount);
    344 _Check_return_ _CRTIMP int __cdecl _wcsnicmp_l(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    345 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl _wcsnset_s(_Inout_updates_z_(_SizeInWords) wchar_t * _Dst, _In_ size_t _SizeInWords, _In_ wchar_t _Val, _In_ size_t _MaxCount);
    346 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(errno_t, _wcsnset_s, _Prepost_z_ wchar_t, _Dst, wchar_t, _Val, _In_ size_t, _MaxCount)
    347 __DEFINE_CPP_OVERLOAD_STANDARD_NFUNC_0_2_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcsnset, _wcsnset_s, _Inout_updates_z_(_Size) wchar_t, _Inout_updates_z_(_MaxCount), wchar_t, _Str, wchar_t, _Val, _In_ size_t, _MaxCount)
    348 _CRTIMP wchar_t * __cdecl _wcsrev(_Inout_z_ wchar_t * _Str);
    349 _Check_return_wat_ _CRTIMP_ALTERNATIVE errno_t __cdecl _wcsset_s(_Inout_updates_z_(_SizeInWords) wchar_t * _Dst, _In_ size_t _SizeInWords, _In_ wchar_t _Value);
    350 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wcsset_s, _Prepost_z_ wchar_t, _Str, wchar_t, _Val)
    351 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcsset, _wcsset_s, _Inout_updates_z_(_Size) wchar_t, _Inout_z_, wchar_t, _Str, wchar_t, _Val)
    352 
    353 _Check_return_wat_ _CRTIMP errno_t __cdecl _wcslwr_s(_Inout_updates_z_(_SizeInWords) wchar_t * _Str, _In_ size_t _SizeInWords);
    354 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _wcslwr_s, _Prepost_z_ wchar_t, _String)
    355 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcslwr, _Inout_z_, wchar_t, _String)
    356 _Check_return_wat_ _CRTIMP errno_t __cdecl _wcslwr_s_l(_Inout_updates_z_(_SizeInWords) wchar_t * _Str, _In_ size_t _SizeInWords, _In_opt_ _locale_t _Locale);
    357 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wcslwr_s_l, _Prepost_z_ wchar_t, _String, _In_opt_ _locale_t, _Locale)
    358 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcslwr_l, _wcslwr_s_l, _Inout_updates_z_(_Size) wchar_t, _Inout_z_, wchar_t, _String, _In_opt_ _locale_t, _Locale)
    359 _Check_return_wat_ _CRTIMP errno_t __cdecl _wcsupr_s(_Inout_updates_z_(_Size) wchar_t * _Str, _In_ size_t _Size);
    360 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(errno_t, _wcsupr_s, _Prepost_z_ wchar_t, _String)
    361 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcsupr, _Inout_z_, wchar_t, _String)
    362 _Check_return_wat_ _CRTIMP errno_t __cdecl _wcsupr_s_l(_Inout_updates_z_(_Size) wchar_t * _Str, _In_ size_t _Size, _In_opt_ _locale_t _Locale);
    363 __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(errno_t, _wcsupr_s_l, _Prepost_z_ wchar_t, _String, _In_opt_ _locale_t, _Locale)
    364 __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(wchar_t *, __RETURN_POLICY_DST, _CRTIMP, _wcsupr_l, _wcsupr_s_l, _Inout_updates_z_(_Size) wchar_t, _Inout_z_, wchar_t, _String, _In_opt_ _locale_t, _Locale)
    365 _Check_return_opt_ _CRTIMP size_t __cdecl wcsxfrm(_Out_writes_opt_(_MaxCount) _Post_maybez_ wchar_t * _Dst, _In_z_ const wchar_t * _Src, _In_ size_t _MaxCount);
    366 _Check_return_opt_ _CRTIMP size_t __cdecl _wcsxfrm_l(_Out_writes_opt_(_MaxCount) _Post_maybez_ wchar_t * _Dst, _In_z_ const wchar_t *_Src, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    367 _Check_return_ _CRTIMP int __cdecl wcscoll(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    368 _Check_return_ _CRTIMP int __cdecl _wcscoll_l(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2, _In_opt_ _locale_t _Locale);
    369 _Check_return_ _CRTIMP int __cdecl _wcsicoll(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    370 _Check_return_ _CRTIMP int __cdecl _wcsicoll_l(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t *_Str2, _In_opt_ _locale_t _Locale);
    371 _Check_return_ _CRTIMP int __cdecl _wcsncoll(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount);
    372 _Check_return_ _CRTIMP int __cdecl _wcsncoll_l(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    373 _Check_return_ _CRTIMP int __cdecl _wcsnicoll(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount);
    374 _Check_return_ _CRTIMP int __cdecl _wcsnicoll_l(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount, _In_opt_ _locale_t _Locale);
    375 
    376 #ifdef __cplusplus
    377 #ifndef _CPP_WIDE_INLINES_DEFINED
    378 #define _CPP_WIDE_INLINES_DEFINED
    379 extern "C++" {
    380 _Check_return_
    381 _When_(return != NULL, _Ret_range_(_Str, _Str+_String_length_(_Str)-1))
    382         inline wchar_t * __CRTDECL wcschr(_In_z_ wchar_t *_Str, wchar_t _Ch)
    383         {return ((wchar_t *)wcschr((const wchar_t *)_Str, _Ch)); }
    384 _Check_return_ inline wchar_t * __CRTDECL wcspbrk(_In_z_ wchar_t *_Str, _In_z_ const wchar_t *_Control)
    385         {return ((wchar_t *)wcspbrk((const wchar_t *)_Str, _Control)); }
    386 _Check_return_ inline wchar_t * __CRTDECL wcsrchr(_In_z_ wchar_t *_Str, _In_ wchar_t _Ch)
    387         {return ((wchar_t *)wcsrchr((const wchar_t *)_Str, _Ch)); }
    388 _Check_return_ _Ret_maybenull_
    389 _When_(return != NULL, _Ret_range_(_Str, _Str+_String_length_(_Str)-1))
    390         inline wchar_t * __CRTDECL wcsstr(_In_z_ wchar_t *_Str, _In_z_ const wchar_t *_SubStr)
    391         {return ((wchar_t *)wcsstr((const wchar_t *)_Str, _SubStr)); }
    392 }
    393 #endif  /* _CPP_WIDE_INLINES_DEFINED */
    394 #endif  /* __cplusplus */
    395 
    396 #if !__STDC__
    397 
    398 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    399 #pragma push_macro("wcsdup")
    400 #undef wcsdup
    401 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    402 
    403 _Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsdup) _CRTIMP wchar_t * __cdecl wcsdup(_In_z_ const wchar_t * _Str);
    404 
    405 #if defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC)
    406 #pragma pop_macro("wcsdup")
    407 #endif  /* defined (_DEBUG) && defined (_CRTDBG_MAP_ALLOC) */
    408 
    409 /* old names */
    410 #define wcswcs wcsstr
    411 
    412 /* prototypes for oldnames.lib functions */
    413 _Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsicmp) _CRTIMP int __cdecl wcsicmp(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    414 _Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsnicmp) _CRTIMP int __cdecl wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t * _Str1, _In_reads_or_z_(_MaxCount) const wchar_t * _Str2, _In_ size_t _MaxCount);
    415 _CRT_NONSTDC_DEPRECATE(_wcsnset) _CRTIMP wchar_t * __cdecl wcsnset(_Inout_updates_z_(_MaxCount) wchar_t * _Str, _In_ wchar_t _Val, _In_ size_t _MaxCount);
    416 _CRT_NONSTDC_DEPRECATE(_wcsrev) _CRTIMP wchar_t * __cdecl wcsrev(_Inout_z_ wchar_t * _Str);
    417 _CRT_NONSTDC_DEPRECATE(_wcsset) _CRTIMP wchar_t * __cdecl wcsset(_Inout_z_ wchar_t * _Str, wchar_t _Val);
    418 _CRT_NONSTDC_DEPRECATE(_wcslwr) _CRTIMP wchar_t * __cdecl wcslwr(_Inout_z_ wchar_t * _Str);
    419 _CRT_NONSTDC_DEPRECATE(_wcsupr) _CRTIMP wchar_t * __cdecl wcsupr(_Inout_z_ wchar_t * _Str);
    420 _Check_return_ _CRT_NONSTDC_DEPRECATE(_wcsicoll) _CRTIMP int __cdecl wcsicoll(_In_z_ const wchar_t * _Str1, _In_z_ const wchar_t * _Str2);
    421 
    422 #endif  /* !__STDC__ */
    423 
    424 #define _WSTRING_DEFINED
    425 #endif  /* _WSTRING_DEFINED */
    426 
    427 #ifdef _CRTBLD
    428 _Check_return_ int __cdecl __ascii_memicmp(_In_reads_bytes_opt_(_Size) const void * _Buf1, _In_reads_bytes_opt_(_Size) const void * _Buf2, _In_ size_t _Size);
    429 _Check_return_ int __cdecl __ascii_stricmp(_In_z_ const char * _Str1, _In_z_ const char * _Str2);
    430 _Check_return_ int __cdecl __ascii_strnicmp(_In_reads_or_z_(_MaxCount) const char * _Str1, _In_reads_or_z_(_MaxCount) const char * _Str2, _In_ size_t _MaxCount);
    431 #endif  /* _CRTBLD */
    432 
    433 #ifdef __cplusplus
    434 }
    435 #endif  /* __cplusplus */
    436 
    437 #endif  /* _INC_STRING */

    cstring

    // cstring standard header
    #pragma once
    #ifndef _CSTRING_
    #define _CSTRING_
    #include <yvals.h>
    
    #ifdef _STD_USING
     #undef _STD_USING
      #include <string.h>
     #define _STD_USING
    
    #else /* _STD_USING */
     #include <string.h>
    #endif /* _STD_USING */
    
     #if _GLOBAL_USING && !defined(RC_INVOKED)
    _STD_BEGIN
    using _CSTD size_t; using _CSTD memchr; using _CSTD memcmp;
    using _CSTD memcpy; using _CSTD memmove; using _CSTD memset;
    using _CSTD strcat; using _CSTD strchr; using _CSTD strcmp;
    using _CSTD strcoll; using _CSTD strcpy; using _CSTD strcspn;
    using _CSTD strerror; using _CSTD strlen; using _CSTD strncat;
    using _CSTD strncmp; using _CSTD strncpy; using _CSTD strpbrk;
    using _CSTD strrchr; using _CSTD strspn; using _CSTD strstr;
    using _CSTD strtok; using _CSTD strxfrm;
    _STD_END
     #endif /* _GLOBAL_USING */
    
    #endif /* _CSTRING_ */
    
    /*
     * Copyright (c) 1992-2013 by P.J. Plauger.  ALL RIGHTS RESERVED.
     * Consult your license regarding permissions and restrictions.
    V6.40:0009 */
  • 相关阅读:
    枚举-完美立方
    list
    undefined reference to `typeinfo for xxx 报错
    bubble排序
    Iframe跨域传值
    Iframe------父子页面传值
    LDAP 概念
    覆盖equals()要覆盖HashCode()
    HashSet和TreeSet的实现与原理
    jvm调优
  • 原文地址:https://www.cnblogs.com/Lunais/p/6062609.html
Copyright © 2011-2022 走看看