Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Other Topics > Computer Technical Help
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-12-2007, 05:31 PM
DeadlyGambit DeadlyGambit is offline
Senior Member
 
Join Date: Jul 2005
Posts: 122
Default PLEASE Help Me With Simple C++ Code!

Okay I have to search a large text file for instances of a user-entered string. I did this using the find function, and it works properly. Here is the problem, I can only find the FIRST occurance of the specified string within any giving line. (I'm searching line by line here, using getline to read lines from the file, and then using find function to find string.) But I need to find ALL instances of the specified string within each line. As of now, it just stops when it finds the first instance within each line.

Example (this is actually the 1st line of text in the file):
Say the search phrase is "hate me "

"5 meg file hate me hate me hate men gg hate merry"

this would result in "hate me" being counted 4 times on that line
("hate me " only twice)
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:05 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.