File array question

Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2005
Posts: 91
Reputation: Jon182 is an unknown quantity at this point 
Solved Threads: 0
Jon182 Jon182 is offline Offline
Junior Poster in Training

Re: File array question

 
0
  #11
Dec 22nd, 2005
I am getting a better understanding of this now, thanks again for your help Dave.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 91
Reputation: Jon182 is an unknown quantity at this point 
Solved Threads: 0
Jon182 Jon182 is offline Offline
Junior Poster in Training

Re: File array question

 
0
  #12
Dec 22nd, 2005
Hey guys, I have currently used the following code.

  1. if(strstr(ch,"hello") != 0)

and the file contains "hellojames" but it gives the hello word count as 1.

I was just wondering why this happens as shouldn't there be white space for this to happen?

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 4,461
Reputation: Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future Dave Sinkula has a brilliant future 
Solved Threads: 255
Team Colleague
Dave Sinkula's Avatar
Dave Sinkula Dave Sinkula is offline Offline
long time no c

Re: File array question

 
0
  #13
Dec 22nd, 2005
Well, "hellojames" definitely contains "hello", so the function faithfully tells you it found it. If you want to look for "hello ", then you may do so.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,678
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1504
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: File array question

 
0
  #14
Dec 23rd, 2005
read my post #4 verrrrrry sloooooooooooooowly and careeeeeeeefullllllllllly. I already covered that topic. pay close attention to what I said about strstr() and the necessity to check for whitespace both before and after the string you want to find.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 91
Reputation: Jon182 is an unknown quantity at this point 
Solved Threads: 0
Jon182 Jon182 is offline Offline
Junior Poster in Training

Re: File array question

 
0
  #15
Dec 23rd, 2005
Thanks.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1974 | Replies: 14
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC