Thema: C++ Ord to VS c++ WCHAR

Einzelnen Beitrag anzeigen

EWeiss
(Gast)

n/a Beiträge
 
#10

AW: Ord to VS c++ WCHAR

  Alt 2. Jun 2017, 14:22
Code:
WCHAR Quote[] = { 34 };
...
Code:
S1 = INWSTR(0, sCfg, Quote);
...

Code:
long INWSTR(IN long nIndex, IN WCHAR* MainStr, IN WCHAR* Search) {
    long nRet = -1;
    long nLength = (long) wcslen(MainStr);
    if (nLength && (wcslen(Search))) {
        WCHAR* pdest;
        if (nIndex > -1) {
            pdest = wcsstr(&MainStr[nIndex], Search);
            if (pdest) { nRet = long(pdest - &MainStr[0]); }
        } else {
            nIndex += 1; if (nIndex < 0) { nIndex *= -1; }
            reverse(MainStr, nLength);
            pdest= wcsstr(&MainStr[nIndex], Search);
            if (pdest) { nRet = nLength - long(pdest - &MainStr[0]) - 1; }
            reverse(MainStr, nLength);
        }
    }
    return nRet + 1;
}
Die länge des Arrays Search = Quote ist 252 Chars lang sollte er aber nicht.

gruss
  Mit Zitat antworten Zitat