这篇教程C++ wcslen函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wcslen函数的典型用法代码示例。如果您正苦于以下问题:C++ wcslen函数的具体用法?C++ wcslen怎么用?C++ wcslen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wcslen函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: mainintmain(int argc, char *argv[]){ register char *filename; register wchar_t *t; size_t buflen = 512; wchar_t *p = malloc(buflen*sizeof(wchar_t)); size_t len; FILE *fp; int ch, rval; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); while ((ch = getopt(argc, argv, "")) != -1) switch(ch) { case '?': default: usage(); } argc -= optind; argv += optind; fp = stdin; filename = "stdin"; rval = 0; do { if (*argv) { if ((fp = fopen(*argv, "r")) == NULL) { warn("cannot open %s", *argv ); rval = 1; ++argv; continue; } filename = *argv++; } while (fgetws(p, buflen, fp)) { len = wcslen(p); /* This is my hack from setpwnam.c -janl */ while (p[len-1] != '/n' && !feof(fp)) { /* Extend input buffer if it failed getting the whole line */ /* So now we double the buffer size */ buflen *= 2; p = realloc(p, buflen*sizeof(wchar_t)); if (p == NULL) err(1, _("unable to allocate bufferspace")); /* And fill the rest of the buffer */ if (fgetws(&p[len], buflen/2, fp) == NULL) break; len = wcslen(p); /* That was a lot of work for nothing. Gimme perl! */ } t = p + len - 1 - (*(p+len-1)=='/r' || *(p+len-1)=='/n'); for ( ; t >= p; --t) if (*t != 0) putwchar(*t); putwchar('/n'); } fflush(fp); if (ferror(fp)) { warn("%s", filename); rval = 1; } if (fclose(fp)) rval = 1; } while(*argv); exit(rval);}
开发者ID:AtariTeenageRiot,项目名称:LUKS,代码行数:78,
示例2: CheckMessageBoxProc//.........这里部分代码省略......... pair<LPCTSTR, UINT> checkdata = (*(pair<LPCTSTR, UINT>*)ExMessageBox::GetUserData()); GetClientRect(hWnd, &rc); iClientHeightBefore = rc.bottom - rc.top; iClientWidthBefore = rc.right - rc.left; GetWindowRect(hWnd, &rc); iWindowWidthBefore = rc.right - rc.left; iWindowHeightBefore = rc.bottom - rc.top; // Create checkbox (resized and moved later) HWND check = CreateWindow(L"BUTTON", checkdata.first, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_VCENTER | BS_CHECKBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, (HMENU)2025, GetModuleHandle(NULL), NULL ); // Assume checked by default SendMessage(check, BM_SETCHECK, checkdata.second, 0); ExMessageBox::SetUserData((void*)checkdata.second); // Apply default font const int cyMenuSize = GetSystemMetrics(SM_CYMENUSIZE); const int cxMenuSize = GetSystemMetrics(SM_CXMENUSIZE); const HFONT hNewFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT); HFONT hOldFont; SIZE size; SendMessage(check, WM_SETFONT, (WPARAM)hNewFont, (LPARAM)TRUE); // Get the size of the checkbox HDC hdc = GetDC(check); hOldFont = (HFONT)SelectObject(hdc, GetStockObject(DEFAULT_GUI_FONT)); GetTextExtentPoint32(hdc, checkdata.first, wcslen(checkdata.first), &size); SelectObject(hdc, hOldFont); ReleaseDC(check, hdc); // Checkbox dimensions int iCheckboxWidth = cxMenuSize + size.cx + 1; int iCheckboxHeight = (cyMenuSize > size.cy) ? cyMenuSize : size.cy; // Vista+ has a different kind of layout altogether if (WinUtil::getOsMajor() >= 6) { // Align checkbox with buttons (aproximately) int iCheckboxTop = int(iClientHeightBefore - (iCheckboxHeight * 1.70)); MoveWindow(check, 5, iCheckboxTop, iCheckboxWidth, iCheckboxHeight, FALSE); // Resize and re-center dialog int iWindowWidthAfter = iWindowWidthBefore + iCheckboxWidth; int iWindowLeftAfter = rc.left + (iWindowWidthBefore - iWindowWidthAfter) / 2; MoveWindow(hWnd, iWindowLeftAfter, rc.top, iWindowWidthAfter, iWindowHeightBefore, TRUE); // Go through the buttons and move them while ((current = FindWindowEx(hWnd, current, L"BUTTON", NULL)) != NULL) { if (current == check) continue; RECT rc; GetWindowRect(current, &rc); ScreenToClient(hWnd, &rc); MoveWindow(current, rc.left + iCheckboxWidth, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE); } } else {
开发者ID:BackupTheBerlios,项目名称:airdc-svn,代码行数:67,
|