Currently viewing: GipsySoft » Front Page» Articles

strright

Return a pointer to the right most n characters in a string.

const char * strright( const char * pcsz, int n );

Return value

The return value either a pointer to the first character which is the nth character from the end of the string or a pointer to the first character in the string if the string is shorter than n.

Example

char szBuf[] = "abcdefg";
char *pszRightThree = strright( szBuf, 3 );
//	pszRightThree is now a pointer to "efg" within szBuf

 

Click to view the source code

See also none