Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching character by character

Status
Not open for further replies.

londonDevil

Programmer
Nov 7, 2002
7
GB
How do I search through arrays character by charcter looking for spaces in order to count the words ?

I have gone as far as saving the info from two seperate windows in two different arrays, on selecting a menu option 'Save' as can be seen from the code below:

......

case IDM_SAVE:

GetWindowText(hWndSmall, Module[index].szTitle, TITLESIZE);
GetWindowText(hWndBig, Module[index].szAbstract, ABSTRACTSIZE);
index++;

.....

Hope 1 of you can shine a light on this.
Thanks! Really Appreciated!
 
In my point of view it would be easier to fullfill the task by saving the text in one long text-buffer and then search that single buffer ('Buffer') as follows:

Clear word counter ('Word_Ctr')
Clear character index counter ('Index')
while(!Buffer[Index])
{
while(!Buffer[Index] && (Buffer[Index] == ' ')) Index++;
Word_Ctr++;
while(!Buffer[Index] && (Buffer[Index] != ' ')) Index++;
}
Now all blocks consisting of non-space folowed by one or more spaces are counted.
That's a start i hope. Totte
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top