Click here to Skip to main content
15,914,074 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: leaked GDI objects! Pin
MAAK7-Mar-03 14:13
MAAK7-Mar-03 14:13 
QuestionCObArray.copy ??? Pin
AnTri7-Mar-03 10:37
AnTri7-Mar-03 10:37 
AnswerRe: CObArray.copy ??? Pin
Chris Losinger7-Mar-03 10:45
professionalChris Losinger7-Mar-03 10:45 
GeneralDrawing ( CView ) Pin
netx20037-Mar-03 10:27
netx20037-Mar-03 10:27 
GeneralRe: Drawing ( CView ) Pin
Chris Losinger7-Mar-03 10:56
professionalChris Losinger7-Mar-03 10:56 
GeneralMiddle button clicked Pin
orcun colak7-Mar-03 10:00
orcun colak7-Mar-03 10:00 
GeneralRe: Middle button clicked Pin
RobJones7-Mar-03 10:31
RobJones7-Mar-03 10:31 
QuestionHow to search a large text file quicker Pin
dazinith7-Mar-03 9:51
dazinith7-Mar-03 9:51 
Hio! I am working on a function that searches a huge text file (28000+ lines) for one line of text.. currently i am reading through every single line to find the number im lookin for.. and reading/loading the file currently takes about 25-30 seconds on a 500mhz..

how can i buffer the whole file faster? notepad only takes a half second to open the file, how can i do that? is there any way to jump to a specific line in a text file such that i can start halfway and go up or down if the number im looking for is higher or lower (the numbers are in order, but not sequential)?

here is what i have now, obviously the line by line approach wont work to well

// loop through and read each line
while (!inFile.eof())
{
	// step progress bar
	WndProgress.StepIt();
	WndProgress.PeekAndPump();
	if (WndProgress.Cancelled()) {
		AfxMessageBox("Progress Error!");
		WndProgress.DestroyWindow();
		return FALSE;
	}

	inFile.getline(szBuffer2, sizeof(szBuffer2)-1);
	strTemp = szBuffer2;  // load line into strTemp

	// ignore all lines which begin with '.'
	if (strTemp.Left(1) != ".")
	{
		CNumberAndName* pEntry = new CNumberAndName();
		pEntry->m_strRoutingNumber = strTemp.Left(9);
		pEntry->m_strBankName = strTemp.Mid(11,36);
		paBankArray->Add(pEntry);
	}
}


also, is there any easy way to tell how many lines long the file is?

thanks a bunch for any suggestions!

still a newb.. cut me some slack :P
-dz
AnswerRe: How to search a large text file quicker Pin
Christian Graus7-Mar-03 10:04
protectorChristian Graus7-Mar-03 10:04 
GeneralRe: How to search a large text file quicker Pin
dazinith7-Mar-03 10:10
dazinith7-Mar-03 10:10 
GeneralRe: How to search a large text file quicker Pin
Neville Franks7-Mar-03 10:22
Neville Franks7-Mar-03 10:22 
AnswerRe: How to search a large text file quicker Pin
Scott H. Settlemier7-Mar-03 10:14
Scott H. Settlemier7-Mar-03 10:14 
GeneralRe: How to search a large text file quicker Pin
dazinith7-Mar-03 10:23
dazinith7-Mar-03 10:23 
GeneralRe: How to search a large text file quicker Pin
Scott H. Settlemier7-Mar-03 11:21
Scott H. Settlemier7-Mar-03 11:21 
AnswerRe: How to search a large text file quicker Pin
Tim Smith7-Mar-03 10:25
Tim Smith7-Mar-03 10:25 
GeneralRe: How to search a large text file quicker Pin
dazinith7-Mar-03 11:00
dazinith7-Mar-03 11:00 
GeneralRe: How to search a large text file quicker Pin
Tim Smith7-Mar-03 11:44
Tim Smith7-Mar-03 11:44 
AnswerRe: How to search a large text file quicker Pin
Ted Ferenc8-Mar-03 2:02
Ted Ferenc8-Mar-03 2:02 
GeneralDShow-implementing CBaseControlWindow Pin
Jakub Misek7-Mar-03 9:36
Jakub Misek7-Mar-03 9:36 
QuestionCompliers and File IO buffer efficiency? Pin
phyzics7-Mar-03 9:12
phyzics7-Mar-03 9:12 
AnswerRe: Compliers and File IO buffer efficiency? Pin
Tim Smith7-Mar-03 9:22
Tim Smith7-Mar-03 9:22 
GeneralHelp With Threads...PLEASE! Pin
dantan987-Mar-03 7:57
dantan987-Mar-03 7:57 
GeneralRe: Help With Threads...PLEASE! Pin
dantan987-Mar-03 7:59
dantan987-Mar-03 7:59 
GeneralRe: Help With Threads...PLEASE! Pin
AlexO7-Mar-03 8:16
AlexO7-Mar-03 8:16 
GeneralRe: Help With Threads...PLEASE! Pin
dantan987-Mar-03 8:34
dantan987-Mar-03 8:34 

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.