myansi.c

来自「PDA上的CF CARD 文件系统的建立程式」· C语言 代码 · 共 77 行

C
77
字号
/*************************************************************
File Name: MYANSI.C (RAMDisk 4.0)			     *
**************************************************************
Programmer: MSC
Last Modified Date: 1999/09/23
Compiler : GNU Cross-compiler/SDS
Platform : X86 protection mode, MIPS, Dragonball
Usage :
	My replacement functions for ANSI-C functions
	See myansi.h for usage.
*************************************************************/
#include <kernel/general.h>
#include <myansi.h>

extern void printString(char *string);

/*************************************************************
Function: myStrLen
Description:
	get the length of a string
Input:
	src - the source string with a mix of single-byte and
	      double-byte chars
Output:
**************************************************************/
int myStrLen(unsigned char *src)
{
  int length = 0;

  while (*src != '\0')
  {
	length++;
	src++;
  }
  return length;
}



/**************************************************************
Function: myStrCpy
Description:
	copy the content of a string to another buffer
Input:
	to - the source string
	from - the destination string
**************************************************************/
unsigned char *myStrCpy(unsigned char *to, const unsigned char *from)
{
  unsigned char *p = to;

  while (*p++ = *from++)
	;

  return(to);
}



/*************************************************************
Function: myPrintInt
Description:
	print a number without going to the next line
Input:
	number - the number to be printed
	type - the form in which the number is printed (DEC, HEX, ...)
**************************************************************/
void myPrintInt(unsigned long number, int type)
{
  char string[20];

  intToString((unsigned int)number, string, type);
  printString(string);
}


⌨️ 快捷键说明

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