Click here to Skip to main content
15,923,852 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Thread Synch Pin
Stephen Caldwell7-Mar-02 12:23
Stephen Caldwell7-Mar-02 12:23 
GeneralRe: Thread Synch Pin
markkuk7-Mar-02 19:47
markkuk7-Mar-02 19:47 
GeneralRe: Thread Synch Pin
Tim Smith7-Mar-02 12:23
Tim Smith7-Mar-02 12:23 
GeneralSending WM_KEYDOWN from other application Pin
Libor Matejka7-Mar-02 10:45
Libor Matejka7-Mar-02 10:45 
GeneralRe: Sending WM_KEYDOWN from other application Pin
Ravi Bhavnani7-Mar-02 11:02
professionalRavi Bhavnani7-Mar-02 11:02 
GeneralRe: Sending WM_KEYDOWN from other application Pin
Tim Deveaux7-Mar-02 11:14
Tim Deveaux7-Mar-02 11:14 
GeneralSearching Through Files Pin
Steven Gregg7-Mar-02 10:44
Steven Gregg7-Mar-02 10:44 
GeneralRe: Searching Through Files Pin
Todd Smith7-Mar-02 12:51
Todd Smith7-Mar-02 12:51 
This is what I use. Other than strlower it should work as is.

template <class InIt, class FwIt>
bool search_input(InIt begin, InIt end, FwIt find1, FwIt find2)
{
	FwIt findstart(find1);
	while (begin != end)
	{
		if (tolower(*begin) == tolower(*find1))
		{
			while (find1 != find2 && begin != end && tolower(*begin) == tolower(*find1))
			{
				++find1;
				++begin;				
			}
			if (find1 == find2)
			{
				return true;
			}
			find1 = findstart;
			continue;
		}
		++begin;
	} 
	return false;
}

bool FindInFile(const char* file, std::string str)
{
	std::ifstream In(file, std::ios::in|std::ios::binary);
	if (!In)
	{
		return false;
	}

	std::string s = str::strlower(std::string(str));

	while (search_input(std::istreambuf_iterator<char>(In), 
		   std::istreambuf_iterator<char>(), s.begin(), s.end()))
	{
		return true;
	}

	return false;
}



Todd Smith


CPUA 0x007 ... shaken not stirred



GeneralRe: Searching Through Files Pin
Tomasz Sowinski7-Mar-02 23:48
Tomasz Sowinski7-Mar-02 23:48 
GeneralLaunch Visual Studio Macro from external application Pin
7-Mar-02 10:21
suss7-Mar-02 10:21 
GeneralMultiple functions versus if/else Pin
RK_20007-Mar-02 10:07
RK_20007-Mar-02 10:07 
GeneralRe: Multiple functions versus if/else Pin
alex.barylski7-Mar-02 10:35
alex.barylski7-Mar-02 10:35 
GeneralRe: Multiple functions versus if/else Pin
Jon Hulatt7-Mar-02 21:59
Jon Hulatt7-Mar-02 21:59 
GeneralSTL iterator::operator+() Pin
moredip7-Mar-02 9:33
moredip7-Mar-02 9:33 
GeneralRe: STL iterator::operator+() Pin
Christian Graus7-Mar-02 9:41
protectorChristian Graus7-Mar-02 9:41 
GeneralRe: STL iterator::operator+() Pin
moredip7-Mar-02 9:48
moredip7-Mar-02 9:48 
GeneralRe: STL iterator::operator+() Pin
Nemanja Trifunovic7-Mar-02 9:58
Nemanja Trifunovic7-Mar-02 9:58 
GeneralRe: STL iterator::operator+() Pin
Joaquín M López Muñoz7-Mar-02 9:49
Joaquín M López Muñoz7-Mar-02 9:49 
Generalefficient sorting [was: STL iterator::operator+()] Pin
moredip7-Mar-02 9:54
moredip7-Mar-02 9:54 
GeneralRe: efficient sorting [was: STL iterator::operator+()] Pin
Joaquín M López Muñoz7-Mar-02 10:02
Joaquín M López Muñoz7-Mar-02 10:02 
GeneralRe: efficient sorting [was: STL iterator::operator+()] Pin
moredip7-Mar-02 10:15
moredip7-Mar-02 10:15 
GeneralRe: efficient sorting [was: STL iterator::operator+()] Pin
Tomasz Sowinski7-Mar-02 23:52
Tomasz Sowinski7-Mar-02 23:52 
GeneralVC++ object layout Pin
Joaquín M López Muñoz7-Mar-02 9:20
Joaquín M López Muñoz7-Mar-02 9:20 
GeneralRe: VC++ object layout Pin
Serge Krynine7-Mar-02 11:32
Serge Krynine7-Mar-02 11:32 
GeneralRe: VC++ object layout Pin
Joaquín M López Muñoz7-Mar-02 11:35
Joaquín M López Muñoz7-Mar-02 11:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.