I am writing a simple program using command line arguments (int main(int argc, char* argv). It must search through a file of text for a character and count how many times it appears in the string.
I have inputted the string and can access all characters of the string (sentence[i]). But I have issues comparing it to the character stored in argv, since it is a char*.
This is comparing two different types, so it cannot be done. I have tried using .c_str() but not successfully.Code:for (int j=0; j<counter;j++) // counter = number of char in sentence string if (sentence[j] == argv) count++;
Any guidance would be appreciated. :)