#include <stdio.h>
#include <string.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
FILE * pFile;
char mystring [100];
pFile = fopen ("C:\\myfile.txt" , "r");
if (pFile == NULL)
::MessageBox(NULL, "Error opening file", "Application", MB_OK);
else
{
fgets (mystring , 100 , pFile);
fclose (pFile);
if(strstr(mystring, "sergio") == (char*) &mystring[0])
{
::MessageBox(NULL, "matched, do action here!", "Application", MB_OK);
}
}
return 0;
}
|