Article View: be.comp.programming
Article #17101Re: Strstrs function problem
From: Wim Dumon
Date: Mon, 21 Feb 2000 00:00
Date: Mon, 21 Feb 2000 00:00
32 lines
1734 bytes
1734 bytes
The Incubus wrote: > > Hi, > > I got a problem with the strstr() function. I am writing a proggie in > Linux.. I'll explain the prob; > > strstr(buffer,"blablabla") > > is what I got in my code, now how can I find out what's behind that > "blablabla"? What does strstr return? Is it the place (like in a pointer) > where the blablabla is, or the number of times blablabla is found in > uffer[ ]... > > I've tried man strstr but it doesn't actually gives me an answer > char *strstr(const char *s1, const char *s2); The strstr() function locates the first occurrence of the string s2 (excluding the terminating null character) in string s1. The strstr() function returns a pointer to the located string, or a null pointer if the string is not found. If s2 points to a string with zero length (that is, the string ""), the function returns s1. So for char *spam = "cooked eggs"; strstr(spam, "eggs"); will return a pointer to spam+7 Wim.
Technical Details
Message-ID:
<38B10C07.ACB1727A@easics.be>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<bVYr4.37062$2v4.67196@afrodite.telenet-ops.be>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcea4,1d75c51a82fe1c2d X-Google-Attributes: gidfcea4,public From: Wim Dumon <wim@easics.be> Subject: Re: Strstrs function problem Date: 2000/02/21 Message-ID: <38B10C07.ACB1727A@easics.be> X-Deja-AN: 587873581 Content-Transfer-Encoding: 7bit References: <bVYr4.37062$2v4.67196@afrodite.telenet-ops.be> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@kpnqwest.net X-Trace: nreader3.kpnqwest.net 951127049 193.74.198.7 (Mon, 21 Feb 2000 10:57:29 MET) Organization: Easics nv, Leuven, Belgium, http://www.easics.com MIME-Version: 1.0 NNTP-Posting-Date: Mon, 21 Feb 2000 10:57:29 MET Newsgroups: be.comp.programming