Originally Posted by
claudiu
To sum things up:
1) Learn to read a STRING from the console like Subsonics suggested.
2) Change the function checkString prototype to what has been suggested.
This should take you literally 2 minutes.
Here is my new code based on all the suggestions. Obviously I'm too stupid to figure this out. Since it should take 2 minutes and its taken me way too long.
Code:
#include <stdio.h>
#include <string.h>
void checkString(char c);
int main()
{
char c[50];
fgets(c, 50, stdin);
while (c != EOF)
{
checkValue(c);
c = getchar();
}
return(0);
}
void checkString(char *c)
{
char *ptr_to_string = malloc(sizeof(char) * 100);
strcpy(ptr_to_string, *c);
char *find = strstr(ptr_to_string, "lb");
if (*find != null)
{
puts("Input contains lb");
}
}