| delorie.com/archives/browse.cgi | search |
| Message-ID: | <312945FA.7985@ns.sympatico.ca> |
| From: | Klaas <klaas AT ns DOT sympatico DOT ca> |
| MIME-Version: | 1.0 |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Substrings |
| References: | <35db4401 DOT 5617263 AT news DOT algonet DOT se> |
| Lines: | 17 |
| Organization: | Sympatico |
| Date: | Thu, 20 Aug 1998 03:03:06 GMT |
| NNTP-Posting-Host: | 142.177.11.75 |
| NNTP-Posting-Date: | Thu, 20 Aug 1998 00:03:06 ADT |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Nicklas Lindgren wrote:
>
> Are there any functions in libc for picking substrings out of strings?
>
> Nicklas Lindgren
you could use this bit of code (or slight modification thereof):
to put n characters of string source at position p into dest:
void mid(char *dest, char *source, int p, int n)
{
char *c=source[p];
strncpy(dest,c,n);
dest[n]=0;
}
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |