Advertisement

Find string in a string true/false strcspn no good

Started by June 12, 2001 04:51 AM
1 comment, last by HellRiZZer 23 years, 8 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

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.
Advertisement
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