[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Function leftstr - return the left portion of a string
Syntax char *leftstr(char *source, int len);
Prototype in stringhk.h
Remarks leftstr performs just like its BASIC counterpart
LEFT$().
leftstr returns the left part of a string.
Return value leftstr returns the leftmost len characters of
source. If the length of source is less than len,
the entire string is returned.
leftstr returns a pointer to the storage location
containing the new string, or NULL if space could
not be allocated.
See also midstr(), rightstr()
Example #include <stringhk.h>
#include <stdio.h> /* for the printf */
main()
{
char msg[25], *l;
strcpy(msg,"This is another test");
l = leftstr(msg,7);
printf("%s\n",msg);
printf("%s\n",l);
}
Program output This is another test
This an
See Also:
midstr()
rightstr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson