⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 func.c

📁 cygnal上的数据采集的程序(带实时时钟)
💻 C
字号:
#include "Func.h"

char* itoa(unsigned int value, char* buf,unsigned char radix)
{
	unsigned int i;
	char* ptr;
	char* temphold;

  	temphold = buf;
	ptr = buf + 12;
	*--ptr = 0;		// Insert NULL char

	do
	{
	   // First create string in reverse order
		i = (value % radix) + 0x30;
		if(i > 0x39)
	 	{
			i += 7;
		}
		*--ptr = i;
		value = value / radix;
  	} while(value != 0);

	// Next, move the string 6 places to the left
	// Include NULL character
	for( ; (*buf++ = *ptr++); )
	{
		;
	}
	return(temphold);
}

char* ltoa(unsigned long value, char* buf,unsigned char radix)
{
	unsigned char i;
	char* ptr;
	char* temphold;

  	temphold = buf;
	ptr = buf + 12;
	*--ptr = 0;		// Insert NULL char

	do
	{
	   // First create string in reverse order
		i = (value % radix) + 0x30;
		if(i > 0x39)
	 	{
			i += 7;
		}
		*--ptr = i;
		value = value / radix;
  	} while(value != 0);

	// Next, move the string 6 places to the left
	// Include NULL character
	for( ; (*buf++ = *ptr++); )
	{
		;
	}
	return(temphold);
}

⌨️ 快捷键说明

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