Find string in a string true/false strcspn no good

Started by
1 comment, last by HellRiZZer 22 years, 10 months ago
I was trying to read a file and find words in it (scripting engine) and can''t figure out how to find out whether a word is in the string i''ve read with fgets. Pleas help.. " Do we need us? "

Warrior of Great Darkness

Advertisement
strcspn() is for something else entirely

You need strstr(). It returns a pointer to wherever it found the substring in the main string, or NULL if it isn''t there.
Or, you simply use the standard-string class function: std::string::find();
Visit:http://www.evildawncrew.comAll things which are worth beeing done, are worth beeing donw well.

This topic is closed to new replies.

Advertisement