hey guys, I am using the following code to count from a text file but I also want to check for ",jo " as well as "jo " I was trying to do it by using while((ch = strstr( ch, "jo ")) != 0) || while((ch = strstr( ch, ",jo ")) != 0) but this doesn't work I was just wondering how I could so this thanks.

char *ch=array;
while((ch = strstr( ch, "jo ")) != 0) 

	if( ch == array '||isspace (*(ch-1)))
		{
			temp.count++;
		      ch++;
													
			
	}
		else
                    {
                        break;
                     }

}

Use this.

while( ( (ch = strstr( ch, "jo ") ) != 0) ||( (ch = strstr( ch, ",jo ")) != 0 ))

Note:
I am not sure about the logic, that is your responsibility. But the syntax is okay.

Hi thanks for your reply the logic seems to be working alright for me. What do you think was wrong with it?

Thanks.

Nothing. I said that because I didnt know your requirements. If it meets your requirements then it is correct.

Nothing. I said that because I didnt know your requirements. If it meets your requirements then it is correct.

Thanks in the end I couldn't use the || even with the correct syntax and just has to use another while loop or for some reason the program would crash. Not sure why it was crashing though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.