• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ putwchar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中putwchar函数的典型用法代码示例。如果您正苦于以下问题:C++ putwchar函数的具体用法?C++ putwchar怎么用?C++ putwchar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了putwchar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: c_columnate

static void
c_columnate(void)
{
    int chcnt, col, cnt, endcol, numcols;
    wchar_t **lp;

    numcols = termwidth / maxlength;
    endcol = maxlength;
    for (chcnt = col = 0, lp = list;; ++lp) {
        wprintf(L"%ls", *lp);
        chcnt += width(*lp);
        if (!--entries)
            break;
        if (++col == numcols) {
            chcnt = col = 0;
            endcol = maxlength;
            putwchar('\n');
        } else {
            while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
                (void)putwchar('\t');
                chcnt = cnt;
            }
            endcol += maxlength;
        }
    }
    if (chcnt)
        putwchar('\n');
}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:28,代码来源:column.c


示例2: iattr

void iattr(void)
{
	register int i;
#ifdef __GNUC__
	register char *lbuf = __builtin_alloca((maxcol+1)*sizeof(char));
#else
	char lbuf[256];
#endif
	register char *cp = lbuf;

	for (i=0; i<maxcol; i++)
		switch (obuf[i].c_mode) {
		case NORMAL:	*cp++ = ' '; break;
		case ALTSET:	*cp++ = 'g'; break;
		case SUPERSC:	*cp++ = '^'; break;
		case SUBSC:	*cp++ = 'v'; break;
		case UNDERL:	*cp++ = '_'; break;
		case BOLD:	*cp++ = '!'; break;
		default:	*cp++ = 'X'; break;
		}
	for (*cp=' '; *cp==' '; cp--)
		*cp = 0;
	for (cp=lbuf; *cp; cp++)
		putwchar(*cp);
	putwchar('\n');
}
开发者ID:Romutk,项目名称:lab3.2n,代码行数:26,代码来源:ul.c


示例3: write_wchars

static inline void
write_wchars(wchar_t buf[], size_t start, size_t end, bool escape,
             bool open_field, bool close_field) {
  size_t j;
  if (escape) {
    if (open_field)
      putwchar(L'"');
    for (j = start; j <= end; ++j) {
      if (buf[IDX(j)] == L'"')
        putwchar(L'"');
      if (putwchar(buf[IDX(j)]) == WEOF) {
        fprintf(stderr, "putwchar error");
        exit(1);
      }
    }
    if (close_field)
      putwchar(L'"');
  } else {
    for (j = start; j <= end; ++j) {
      if (putwchar(buf[IDX(j)]) == WEOF) {
        fprintf(stderr, "putwchar error");
        exit(1);
      }
    }
  }
}
开发者ID:Snazz2001,项目名称:data-tools,代码行数:26,代码来源:tab_to_csv.c


示例4: matchContext

void
matchContext(wchar_t *T, regexNode re)
{
    int start, end, currPos;

    int i, n;

    currPos = start = end = 0;
    n = wcslen(T);

    while (currPos < n)
    {
        if (re_match2(re, T, &start, &end))
        {
            putwchar(L' ');
            for (i=start; i<end; i++)
              putwchar(*(T+i));
            //wprintf(L"匹配成功,识别边界为[%d, %d)\n", start, end);
            putwchar(L' ');
            currPos = end;
        }
        else
        {
            putwchar(*(T+currPos));
            currPos++;
            start = end = currPos;
        }

    }
    //wprintf(L"匹配失败\n");

}
开发者ID:LuStark,项目名称:regex-engine,代码行数:32,代码来源:Regex.c


示例5: r_columnate

static void
r_columnate(void)
{
    int base, chcnt, cnt, col, endcol, numcols, numrows, row;

    numcols = termwidth / maxlength;
    numrows = entries / numcols;
    if (entries % numcols)
        ++numrows;

    for (row = 0; row < numrows; ++row) {
        endcol = maxlength;
        for (base = row, chcnt = col = 0; col < numcols; ++col) {
            wprintf(L"%ls", list[base]);
            chcnt += width(list[base]);
            if ((base += numrows) >= entries)
                break;
            while ((cnt = roundup(chcnt + 1, TAB)) <= endcol) {
                (void)putwchar('\t');
                chcnt = cnt;
            }
            endcol += maxlength;
        }
        putwchar('\n');
    }
}
开发者ID:wan721,项目名称:DragonFlyBSD,代码行数:26,代码来源:column.c


示例6: print_grid

void print_grid(FILE *out, const grid_t *grid) {
  for (int row = 0; row < grid->height; row++) {
    for (int col = 0; col < grid->width; col++) {
      putwchar(get_pipe_wchar(grid->grid[GRID_INDEX(grid, row, col)]));
    }
    putwchar(L'\n');
  }
}
开发者ID:tomvand,项目名称:dailyprogrammer,代码行数:8,代码来源:print.c


示例7: display

// Display a file.
void display( LPCTSTR name, BOOL title )
{
  HANDLE file;
  int	 c;
  LARGE_INTEGER size, offset;

  // Handle the pipe differently.
  if (*name == '-' && name[1] == '\0')
  {
    if (title)
      putwchar( '\n' );
    while ((c = getchar()) != EOF)
      putchar( c );
    return;
  }

  file = CreateFile( name, GENERIC_READ, FILE_SHARE_READ, NULL,
		     OPEN_EXISTING, 0, NULL );
  if (file == INVALID_HANDLE_VALUE)
  {
    print_error( name, title );
    return;
  }

  GetFileSizeEx( file, &size );
  if (size.QuadPart != 0)
  {
    HANDLE map = CreateFileMapping( file, NULL, PAGE_READONLY, 0, 0, NULL );
    if (map)
    {
      if (title)
	putwchar( '\n' );
      offset.QuadPart = 0;
      do
      {
	DWORD len = (size.QuadPart > 65536) ? 65536 : size.LowPart;
	LPVOID mem = MapViewOfFile( map, FILE_MAP_READ, offset.HighPart,
				    offset.LowPart, len );
	if (mem)
	{
	  fwrite( mem, 1, len, stdout );
	  UnmapViewOfFile( mem );
	}
	else
	{
	  print_error( name, title );
	  break;
	}
	offset.QuadPart += len;
	size.QuadPart -= len;
      } while (size.QuadPart);
      CloseHandle( map );
    }
    else
      print_error( name, title );
  }
  CloseHandle( file );
}
开发者ID:kmkkmk,项目名称:app,代码行数:59,代码来源:ansicon.c


示例8: _putws

/*
 * @implemented
 */
int _putws(const wchar_t *s)
{
    wint_t c;
    
    while ((c = *s++)) {
        putwchar(c);
    }
    return putwchar(L'\n');
}
开发者ID:changloong,项目名称:msvcrt,代码行数:12,代码来源:puts.c


示例9: output_indent

/* Output spaces or tabs for leading indentation.
 */
static void
output_indent(size_t n_spaces) {
  if (output_tab_width) {
    while (n_spaces >= output_tab_width) {
      putwchar('\t');
      n_spaces -= output_tab_width;
    }
  }
  while (n_spaces-- > 0) putwchar(' ');
}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:12,代码来源:fmt.c


示例10: main

int
main(int argc, char *argv[])
{
	const char *filename;
	wchar_t *p, *t;
	FILE *fp;
	size_t len;
	int ch, rval;

	setlocale(LC_ALL, "");
	setprogname(argv[0]);

	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("%s", *argv);
				rval = 1;
				++argv;
				continue;
			}
			filename = *argv++;
		}
		while ((p = fgetwln(fp, &len)) != NULL) {
			if (p[len - 1] == L'\n')
				--len;
			t = p + len - 1;
			for (t = p + len - 1; t >= p; --t)
				putwchar(*t);
			putwchar(L'\n');
		}
		if (ferror(fp)) {
			warn("%s", filename);
			rval = 1;
		}
		(void)fclose(fp);
	} while(*argv);
	exit(rval);
}
开发者ID:Hooman3,项目名称:minix,代码行数:51,代码来源:rev.c


示例11: put1wc

/* Output an ASCII character as a wide character */
static int put1wc(int c)
{
	if (putwchar(c) == WEOF)
		return EOF;
	else
		return c;
}
开发者ID:Webster-WXH,项目名称:util-linux,代码行数:8,代码来源:ul.c


示例12: pflush

void pflush(int ol)
{
	register int i;
	register wchar_t *cp;
	char lastomit;
	int l;

	l = ol;
	lastomit = 0;
	if (l > 266)
		l = 266;
	else
		l |= 1;
	for (i = first | 1; i < l; i++) {
		move(i, i - 1);
		move(i, i + 1);
	}
	for (i = first; i < l; i++) {
		cp = page[i];
		if (printall == 0 && lastomit == 0 && *cp == 0) {
			lastomit = 1;
			continue;
		}
		lastomit = 0;
		fputws(cp, stdout);
		putwchar('\n');
	}
	bcopy(page[ol], page, (267 - ol) * 132 * sizeof(wchar_t));
	bzero(page[267- ol], ol * 132 * sizeof(wchar_t));
	outline -= ol;
	outcol = 0;
	first = 1;
}
开发者ID:DentonGentry,项目名称:gfiber-gfrg100,代码行数:33,代码来源:colcrt.c


示例13: center_stream

/* Process a stream, but just center its lines rather than trying to
 * format them neatly.
 */
static void
center_stream(FILE *stream, const char *name)
{
    wchar_t *line, *p;
    size_t length;
    size_t width;
    int cwidth;

    while ((line = get_line(stream, &length)) != NULL) {
        size_t l = length;

        while (l > 0 && iswspace(*line)) {
            ++line;
            --l;
        }
        length = l;
        for (p = line, width = 0; p < &line[length]; p++)
            width += (cwidth = wcwidth(*p)) > 0 ? cwidth : 1;
        l = width;
        while (l < goal_length) {
            putwchar(' ');
            l += 2;
        }
        wprintf(L"%.*ls\n", (int)length, line);
    }
    if (ferror(stream)) {
        warn("%s", name);
        ++n_errors;
    }
}
开发者ID:tomtor,项目名称:freebsd,代码行数:33,代码来源:fmt.c


示例14: main

int main ()
{
  wchar_t wc;
  for (wc = 'A' ; wc <= 'Z' ; ++wc) putwchar (wc);

  return 0;
}
开发者ID:rainloader,项目名称:eclipse,代码行数:7,代码来源:test.c


示例15: put1wc

static int put1wc(int c) /* Output an ASCII character as a wide character */
{
  if (putwchar(c) == WEOF)
    return EOF;
  else
    return c;
}
开发者ID:Romutk,项目名称:lab3.2n,代码行数:7,代码来源:ul.c


示例16: locale_advance

/* ARGSUSED */
static void
locale_advance(struct termp *p, size_t len)
{
	size_t	 	i;

	for (i = 0; i < len; i++)
		putwchar(L' ');
}
开发者ID:2015520,项目名称:SequoiaDB,代码行数:9,代码来源:term_ascii.c


示例17: WriteChar

INLINE void WriteChar(Int32 const &c) {
#ifdef __linux
    printf("%lc", c);
    fflush(stdout);                     // 令 Linux 终端立即输出 而不是等 \n
#else
	putwchar(c);
#endif
}
开发者ID:chenweihua,项目名称:69net,代码行数:8,代码来源:Console.hpp


示例18: CWE252_Unchecked_Return_Value__wchar_t_putchar_04_bad

void CWE252_Unchecked_Return_Value__wchar_t_putchar_04_bad()
{
    if(STATIC_CONST_TRUE)
    {
        /* FLAW: Do not check the return value */
        putwchar((wchar_t)L'A');
    }
}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:8,代码来源:CWE252_Unchecked_Return_Value__wchar_t_putchar_04.c


示例19: good1

static void good1()
{
    /* FIX: check for the correct return value */
    if (putwchar((wchar_t)L'A') == WEOF)
    {
        printLine("putwchar failed!");
    }
}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:8,代码来源:CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_putchar_01.c


示例20: CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_putchar_01_bad

void CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_putchar_01_bad()
{
    /* FLAW: putwchar() might fail, in which case the return value will be WEOF (-1), but
     * we are checking to see if the return value is 0 */
    if (putwchar((wchar_t)L'A') == 0)
    {
        printLine("putwchar failed!");
    }
}
开发者ID:gpwi970725,项目名称:testJuliet1,代码行数:9,代码来源:CWE253_Incorrect_Check_of_Function_Return_Value__wchar_t_putchar_01.c



注:本文中的putwchar函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pv函数代码示例发布时间:2022-05-30
下一篇:
C++ pututxline函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap