rvint.c

来自「h.248协议源码」· C语言 代码 · 共 49 行

C
49
字号
#if (0)
************************************************************************
Filename:
Description:
************************************************************************
                Copyright (c) 1999 RADVision Inc.
************************************************************************
NOTICE:
This document contains information that is proprietary to RADVision LTD.
No part of this publication may be reproduced in any form whatsoever 
without written prior approval by RADVision LTD..

RADVision LTD. reserves the right to revise this publication and make 
changes without obligation to notify any person of such revisions or 
changes.
************************************************************************
************************************************************************
$Revision:$
$Date:$
$Author: S. Cipolli$
************************************************************************
#endif

#include "rvstr.h"
#include "rvint.h"

/* Our own version of itoa since some platforms don't provide it */
/* The function assumes s points to an array large enough to hold */
/* the converted int */
char* rvIntToStr(int n, char* s, int radix) {
	static const char* digits = "0123456789abcdefghijklmnopqrstuvwxyz";
	int i = 0;
	int sign = n;

	if ((radix == 10) && (n < 0)) n = -n;

	do {
		s[i++] = digits[n % radix];
		n /= radix;
	} while (n > 0);

	if (sign < 0) s[i++] = '-';
	s[i] = '\0';

	return rvStrRevN(s, i);
}


⌨️ 快捷键说明

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