tcstoeucs.c

来自「T-kernel 的extension源代码」· C语言 代码 · 共 51 行

C
51
字号
/* *---------------------------------------------------------------------- *    T-Kernel / Standard Extension * *    Copyright (C) 2006 by Ken Sakamura. All rights reserved. *    T-Kernel / Standard Extension is distributed  *      under the T-License for T-Kernel / Standard Extension. *---------------------------------------------------------------------- * *    Version:   1.00.00 *    Released by T-Engine Forum(http://www.t-engine.org) at 2006/8/11. * *---------------------------------------------------------------------- *//* *	tcstoeucs.c (libtcstr) * *	W	tcstoeucs(UB* eucstr, const TC* tcstr) * *	Convert a TC character string into an EUC character string. *	Return the length of converted EUC character string ((=strlen(eucstr)). *	If eucstr == NULL, do not store the conversion result, but return a correct function value. *	If the character string cannot be converted, return the function value "-1". */#include <basic.h>#include <tstring.h>#define TSD_TTE_RTN_M1	(-1)EXPORT	W	tcstoeucs( UB *eucstr, const TC *tcstr ){	W	tlen, len;	for (tlen = 0;  ;tlen += len) {		len = tctoeuc(eucstr, *(tcstr++));		if (len <= 0) {			break;		}		if (eucstr != 0) {			eucstr += len;		}	}	if (eucstr != 0) {		*eucstr = 0;	}	return 	(len < 0) ? TSD_TTE_RTN_M1 : tlen;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?