I'm doing some very basic coding in Visual Studio.
I am attempting to check the output of a command for a group of period separated digits or a string. It works fine when checking for a string but it doesn't seem to work if I ask it to look for a group of period separated digits such as 4.2.3
The code I am using is as follows
BOOL CheckLogForString(char* str)
{
FILE* f = fopen (LogName, "r");
if (NULL == f){ MessageBox(0, "Can't find log!","error",MB_APPLMODAL|MB_OK|MB_ICONSTOP);return FALSE;}
BOOL found = false;
while (!feof(f))
{
char buf[1000]="";
if (fgets(buf,1000,f)==NULL) break;
strupr(buf);
if (0 != strstr (buf, str))found = TRUE;
}
fclose (f);
return found;
}
I then call this as follows
if (CheckLogForString("WORDS"))
{
DO SOMETHING
}
That works fine but when I try
if (CheckLogForString("4.2.3"))
{
DO SOMETHING
}
It doesn't work. What can I do to make it work please?