Toss out all that C code and replace it with c++. use std::string and >> insert operator and you don't have to do any tokenizing at all. Here's an example
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
string word;
// stay in the loop until you press Ctrl+Z <Enter>
while( cin >> word )
{
// convert the word to lower-case
transform(word.begin(),word.end(),word.begin(),::tolower);
// now find the word in the database (not shown here)
cout << word << endl;
}
cout << "done " << endl;
return 0;
}
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Online 21,963 posts
since Aug 2005