Hi...can someone please help me with the above as its preventing my strstr function from performing correctly....any pointers much appreciated as I am a beginner....
Hi...can someone please help me with the above as its preventing my strstr function from performing correctly....any pointers much appreciated as I am a beginner....
char *p = strchr( buff, '\n' ) if ( p ) *p = '\0';
If you're reading input using fgets(), this is all discussed in the FAQ
Just a minor nit... A missing ';', it should readOriginally Posted by SalemSalem knows this, it's just a typo...Code:char *p = strchr( buff, '\n' ); if ( p ) *p = '\0';
Insert obnoxious but pithy remark here
And don't forget <string.h>.
Here's the relevant FAQ entry: http://faq.cprogramming.com/cgi-bin/...&id=1043284385
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.