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

📄 string.h

📁 图像处理的压缩算法
💻 H
📖 第 1 页 / 共 4 页
字号:
		The lstrcmp (alias strcmp) function compares two character strings. The comparison is case sensitive.
	Example:
		string	str1 = "Hello World!";
		int 	cmp = lstrcmp(str1, "HELLO WORLD!");	// cmp equals -1.
		out_int("cmp = ", cmp);
	Parameters:
		lpString1=Pointer to the first null-terminated string to be compared. 
		lpString2=Pointer to the second null-terminated string to be compared.
	Return:
		If the string pointed to by lpString1 is less than the string pointed to by lpString2, the return value is negative. 
		If the string pointed to by lpString1 is greater than the string pointed to by lpString2, the return value is positive. 
		If the strings are equal, the return value is zero. 
*/
int	WINAPI lstrcmp(LPCSTR lpString1, LPCSTR lpString2);
	
/** >Character/String Manipulation
		The lstrcmpi (alias stricmp) function compares two character strings. The comparison is not case sensitive.
	Example:
		string	str1 = "Hello World!";
		int 	cmp = lstrcmpi(str1, "HELLO WORLD!");	// cmp equals 0.
		out_int("cmp = ", cmp);
	Parameters:
		lpString1=Pointer to the first null-terminated string to be compared. 
		lpString2=Pointer to the second null-terminated string to be compared.
	Return:
		If the string pointed to by lpString1 is less than the string pointed to by lpString2, the return value is negative. 
		If the string pointed to by lpString1 is greater than the string pointed to by lpString2, the return value is positive. 
		If the strings are equal, the return value is zero.
*/
int WINAPI lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);

////////////////////////////////////////////////////////////////////

#pragma dll(msvcrt, system)

/** >Character/String Manipulation
*/
LPSTR strcpy(LPSTR lpString1, LPCSTR lpString2);

/** >Character/String Manipulation
*/
LPSTR strcat(LPSTR lpString1, LPCSTR lpString2);

/** >Character/String Manipulation
*/
int	strlen(LPCSTR lpString);

/** >Character/String Manipulation
		The strncpy function copies a specified number of characters from a source string into a buffer.
	Example: 
		string		str1 = "Hello World!";
		char		szStr[80];
		strncpy(szStr, str1, 5);
		out_str(szStr);	// Should be "Hello"
	Parameters:
		lpString1=Pointer to a buffer into which the function copies characters. The buffer must be large enough to contain the number of characters specified by iMaxLength.
		lpString2=Pointer to a null-terminated string from which the function copies characters.
		iMaxLength=Specifies the number of characters to be copied from the string pointed to by lpString2 into the buffer pointed to by lpString1, without a terminating null character.
	Return values: 
		If the function succeeds, the return value is a pointer to the buffer.  If the function fails, the return value is NULL.
*/
LPSTR strncpy(LPSTR lpString1, LPCSTR lpString2, int iMaxLength);

/** >Character/String Manipulation
*/
int	strcmp(LPCSTR lpString1, LPCSTR lpString2);

/** >Character/String Manipulation
*/
int _stricmp(LPCSTR lpString1, LPCSTR lpString2);

/** >Character/String Manipulation
*/
int stricmp(LPCSTR lpString1, LPCSTR lpString2);

/** >Character/String Manipulation
		Find the first occurrence of a character in a string.
	Example:
		string	str1 = "Hello World!";
		out_str(strchr(str1,'W'));
		ASSERT(strchr(str1,'A')==NULL);
	Parameters:
		lpcszStr=NULL terminated source string
		cc=Character to be located
	Return:
		Returns a pointer to the first occurrence of a character in a string.
*/
LPSTR	strchr(LPCSTR lpcszStr, int cc); // Find the first occurrence of a character in a string.

/** >Character/String Manipulation
		Scan a string for the last occurrence of a character.
	Example:
		string	str1 = "Hello World!";
		out_str(strrchr(str1,'o'));
		ASSERT(strrchr(str1,'A')==NULL);
	Parameters:
		lpcszStr=Null terminated source string
		cc=Character to be located
	Return:
		Returns a pointer to the last occurrence of a character in a string.
*/
LPSTR	strrchr(LPCSTR lpcszStr, int cc); // Scan a string for the last occurrence of a character.

/** >Character/String Manipulation
		Append the first N characters of one string to a second string.
	Example:
		char str1[]="Hello world from ";
		strncat( str1, "strcpy!xxxxxxxx", 7 );
		out_str( str1 );
	Parameters:
		lpszDestination=String that is appended to
		lpcszSource=String that is appended
		count=Number of characters to append
	Return:
		Returns a pointer to the destination string with N characters from source string appended.
*/
LPSTR	strncat( LPSTR lpszDestination, LPCSTR lpcszSource, size_t count ); // Append the first N characters of one string to a second string.

/** >Character/String Manipulation
		Compare the first N characters of two strings.
	Example:
		char str1[] = "Hello world!xxxxxxxx";
		char str2[] = "Hello world!";		
		printf( "String1 = %s\n", str1 );
		printf( "String2 = %s\n", str2 );
		ASSERT(strcmp(str1,str2)!=0);
		ASSERT(strncmp(str1,str2,12)==0);
	Parameters:
		lpcszString1=First of two strings to compare
		lpcszString2=Second of two strings to compare
		count=Number of characters N to compare
	Return:
		Returns an integer < 0 if the first N characters of string1 are alpha-numerically less than
		string2, returns 0 if the first N characters of string1 are the same as string2, and returns
		an integer > 0 if the first N characters of string1 are alpha-numerically greater than string2.
*/
int 	strncmp( LPCSTR lpcszString1, LPCSTR lpcszString2, size_t count ); // Compare the first N characters of two strings.

/** >Character/String Manipulation
		Find a prefix substring in a string consisting entirely of characters
		in a specified character set.
	Example:
		char str1[] = "Mississippi";
		ASSERT(strspn( str1, "Mis" )==8);
		ASSERT(strspn( str1, "Misp" )==strlen(str1));
	Parameters:
		lpcszString=String to search through
		lpcszCharSet=String containing specified character set
	Return:
		Returns the 0 based index of the first character in a string that is
		not in a specified character set. All characters before returned index
		are in the character set.
*/ 
size_t	 strspn( LPCSTR lpcszString, LPCSTR lpcszCharSet ); // Find a prefix substring in a string consisting entirely of characters in a specified character set.

/** >Character/String Manipulation
		Find a prefix substring in a string not containing any characters
		in a specified character set.
	Example:
		char str1[] = "Mississippi";
		ASSERT(strcspn( str1, "qrst" )==2);
	Parameters:
		lpcszString=String to search through
		lpcszCharSet=String containing specified character set
	Return:
		Returns the 0 based index of the first character in a string that is
		in a specified character set. All characters before returned index
		are not in character set.
*/
size_t	strcspn( LPCSTR lpcszString, LPCSTR lpcszCharSet ); // Find a prefix substring in a string not containing any characters in a specified character set.

/** >Character/String Manipulation
		Scan strings for characters in a specified character set.
	Example:
		char str1[] = "I saw 3 blind mice";
		char* pdest = strpbrk(str1,"123456789");
		out_str(pdest);
		ASSERT(strcmp(pdest,"3 blind mice")==0);
	Parameters:
		lpcszString=String to search through
		lpcszCharSet=String containing specified character set
	Return:
		Returns a pointer to the first occurrence of a character in a string that is in specified a character set.
*/
LPSTR	strpbrk( LPCSTR lpcszString, LPCSTR lpcszCharSet ); // Scan strings for characters in a specified character set.

/** >Character/String Manipulation
		Find a substring.
	Example:
		char str1[] = "I saw 3 blind mice";
		char * pdest = strstr(str1,"blind");
		out_str(pdest);
		ASSERT(strcmp(pdest,"blind mice")==0);
	Parameters:
		lpcszString=String to search through
		lpcszCharSet=Substring to search for
	Return:
		Returns a pointer to the first character of a substring.
*/
LPSTR	 strstr( LPCSTR lpcszString, LPCSTR lpcszCharSet ); // Find a substring.

/** >Character/String Manipulation
		Get a system error message (strerror) or print a user-supplied error message (_strerror).
	Example:
		char * pErr;
		string strPrevious;
		int ii = 0;
		for(;1;)
		{
			strPrevious = pErr;
			pErr = strerror(ii++);
			if( strcmp(pErr,strPrevious)==0 )
				break;
			out_str(pErr);
		}
	Parameters:
		iErrNum=Error number whose error message is returned
	Return:
		Returns a pointer to the first character of an error message associated with iErrNum.
*/
LPSTR	strerror( int iErrNum ); // Get a system error message (strerror) or print a user-supplied error message (_strerror).

/** >Character/String Manipulation
		Find the next token in a string.
	Example:
		char str9[] = "This,is a.list\tof:tokens";
		char str10[] = ", .\t:";
		char * ptok;
		ptok = strtok(str9,str10);
		out_str(ptok);
		while(ptok=strtok(NULL,str10))
			out_str(ptok);
	Parameters:
		lpszStrToken=String containing tokens to be parsed
		lpcszDelimit=String containing delimiters
	Return:
		Returns a pointer to the first character of the next token.
*/
LPSTR	strtok( LPCSTR lpszStrToken, LPCSTR lpcszDelimit ); // Find the next token in a string.

/** >Character/String Manipulation
		Copy characters between buffers.
	Example:
		struct myStruct
		{
				int myint;
				double mydouble;
		};
	
		myStruct aa, bb;	
		memset(&aa, 5, sizeof(myStruct));	// Set every byte of structure aa to 5.
		memset(&bb, 0, sizeof(myStruct));	// Set every byte of structure bb to 0.
		memcpy(&aa, &bb, sizeof(myStruct));	// Now every byte of structure aa is 0 too.
	Parameters:
		lpDestination=New buffer
		lpSource=Buffer to copy from
		nSize=Number of characters to copy
	Returns:
		The value of lpDestination.
*/ 
LPVOID	memcpy(LPVOID lpDestination, const LPVOID lpSource, UINT uSize); // Copy characters between buffers.

/** >Character/String Manipulation
		Set buffers to a specified character.
	Example:
		int aa;
		memset(&aa, 10, sizeof(int));
	Parameters:
		lpMem=Pointer to lpMem
		nValue=Integer value to set
		nSize=Number of integer value
	Return:
		The value of lpMem.
*/ 
LPVOID	memset(LPVOID lpMem, int nValue, UINT uSize); // Set buffers to a specified character.

/** >Character/String Manipulation
		Compares characters between two buffers.
	Example:
		char	szFirst[] = "12345678901234567890";
		char	szSecond[] = "12345678901234567891";
		int		nNumerOfBytesToCompare = 19;	// change this to 20 to see a different result
		
		int		nResult = memcmp(szFirst, szSecond, nNumerOfBytesToCompare);
		if (0 == nResult)
			out_str("Equal");
		else if (0 > nResult)
			out_str("First is less than second");
		else
			out_str("First is greater than second");
	Parameters:
		lpMem1: First buffer 
		lpMem2: Second buffer
		nSize:  Number of characters to compare.
	Return:
		Returns an integer < 0 if lpMem1 is less than lpMem2, returns 0 if lpMem1 is identical to lpMem2, and returns
		an integer > 0 if lpMem1 greater than lpMem2.
*/
int		memcmp(LPCVOID lpMem1, LPCVOID lpMem2, UINT uSize); // Compares characters between two buffers.

/** >Character/String Manipulation
		Move contents of one buffer to another.
	Example:
		char * pRet;
		char str1[40];
		char str2[] = "Hello World!xxxxxxxx";
		printf( "String1 = %s\n", str1 );
		printf( "String2 = %s\n", str2 );
		pRet = (char *) memmove(str1,str2,12);
		out_str(pRet);
		printf( "String1 = %s\n", str1 );
		printf( "String2 = %s\n", str2 );
	Parameters:
		dest=Destination buffer
		src=Source buffer
		count=Number of characters to move
	Return:
		Returns a pointer to moved characters.
*/
LPVOID	memmove( LPVOID dest, LPCVOID src, size_t count ); // Move contents of one buffer to another.

/** >Character/String Manipulation
		Find a pointer to first occurrence of character.
	Example:
		char * pChar;
		char str1[] = "Mississippi";
		pChar=(char*) memchr(str1,'s',11);
		out_str(pChar);
	Parameters:
		buf=Buffer to search in 
		c=Character to search for
		count=Number of characters to search in buffer
	Return:
		Returns a pointer to first occurrence of character.
*/
LPVOID	memchr( LPCVOID buf, int c, size_t count ); // Find a pointer to first occurrence of character.
// End GJL 11/18/02 v7.0437 ADD_ANSI_C_STRING_FUNCS1

// GJL 11/18/02 v7.0437 ADD_ANSI_C_STRING_FUNCS2
/** >Character/String Manipulation
		Read data from a string according to a standard C format specification and return data
		values in a series of user specified receptor variables.
	Example:
		char str2[10], str1[]="Hello C 15 17.56";
		char cChar;
		int iInt;
		float fFloat;
		int N;
		N = sscanf( str1, "%s %c %d %f", str2, &cChar, &iInt, &fFloat);
		out_str(str1);
		out_str(str2);
		printf("%c\n",cChar);
		out_int("",iInt);
		out_double("",fFloat);
	Parameters:
		lpcszBuffer=String to search through for formated data
		lpcszFormat=Standard C format specification
		...=A comma separated list of receptor variables to hold returned data values
	Return:
		Returns the number of data values which are returned in receptor variables and data values
		in receptor variables.
*/
int sscanf( LPCSTR lpcszBuffer, LPCSTR lpcszFormat, ... ); // Read data from a string according to a standard C format specification.

/** >Character/String Manipulation
		Write data values stored in a series of user specified variables into a string according
		to a standard C format specification.
	Example:
		char str1[] = "Hello", str2[50];
		char cChar = 'C';
		int N, iInt = 15;
		float fFloat = 17.56;
		N = sprintf( str2, "%s %c %d %f", str1, cChar, iInt, fFloat);
		out_str(str1);
		printf("%c\n",cChar);
		out_int("",iInt);
		out_double("",fFloat);
		out_str(str2);
	Parameters:
		lpcszBuffer=String where formated data is written
		lpcszFormat=Standard C format specification
		...=A comma separated list of user specified variables holding data values
	Return:
		Returns the number of characters which are written into the string.
	SeeAlso:
		string::Format
*/
int sprintf( LPSTR lpszBuffer, LPCSTR lpcszFormat, ... ); // Write data into a string according to a standard C format specification.
// End GJL 11/18/02 v7.0437 ADD_ANSI_C_STRING_FUNCS2

#endif //!_STRING_H

⌨️ 快捷键说明

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