Hey guys,
I have the following code, but for some reason it does not work with bigger txt files is this because of the size of the array?
And if so is there a simple way to solve the problem?
Thanks in advance for any help.
char ch[1000];
int v_word = 0;
int c_word = 0;
ifstream file("c:/test.txt");
if (file.is_open())
{
while (file.getline(ch, 1000))
if(strcmp(ch, "int") == 0)
v_word++;
}
cout<<v_word<<endl;
cout<<c_word<<endl;
file.close();