Nigel Liang <[EMAIL PROTECTED]> writes: > +/* Utility functions to convert between WCHAR and long */ > +long wcstolong(WCHAR * wcs) > +{ > + int i; > + long lRet = 0; > + BOOL bNeg = FALSE; > + > + for (i = 0; wcs[i] != '\0'; i++) { > + if (i == 0 && wcs[i] == '-') { > + bNeg = TRUE; > + continue; > + } > + > + lRet = lRet * 10 + (wcs[i] - '0'); > + } > + return (bNeg ? -lRet : lRet); > +} > + > +WCHAR *longtow(long num, WCHAR *wcs) > +{ > + static const WCHAR str[] = { '%', 'l', 'd', 0 }; > + wsprintfW(wcs, str, num); > + return wcs; > +}
That's ugly. You should avoid using long if not really necessary, since it doesn't have the same size in MSVC. You shouldn't name a function wcs something since that's what wchar_t functions use. In any case we already have atoiW for that purpose. Also I don't think wrapping wsprintf is needed. -- Alexandre Julliard [EMAIL PROTECTED]