Hi... sorry I had forgot to declare string str while posting this code :)
Yes this code complies and no error at runtime but the output is just 1 for count and rest is the same.
I wrote a separate program and it works perfectly as you had suggested using std::string::find but I am not just able to make it work while reading the file :( :( and need help in that.
Here is the code that works
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main ()
{
std::string str("Crochunter Banfa Help Bytes");
std::string::size_type tab_pos( 0 );
int count(0);
while ( tab_pos!=std::string::npos )
{
tab_pos = str.find("\t", tab_pos );
if ( tab_pos != std::string::npos )
{
++count;
tab_pos += 3; // start next search after this "\t"
}
}
cout << count+1 << endl;
return 0;
}
Howto make this logic work while reading is still something I am not able to get :(
The input File is a simple Tab delimited file.
Thanks a need your suggestions.