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