Click here to Skip to main content
15,901,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalsb live Pin
nvd229-Mar-05 17:54
nvd229-Mar-05 17:54 
GeneralRe: sb live Pin
Joel Holdsworth29-Mar-05 20:47
Joel Holdsworth29-Mar-05 20:47 
GeneralCalling Forms from Forms Pin
mvtapia29-Mar-05 17:52
mvtapia29-Mar-05 17:52 
GeneralDevice driver compatability between Win95 & Win98 Pin
Neha.marwaha29-Mar-05 16:51
Neha.marwaha29-Mar-05 16:51 
GeneralRe: Device driver compatability between Win95 & Win98 Pin
MMansonFan2529-Mar-05 22:46
MMansonFan2529-Mar-05 22:46 
QuestionCould anyone help me, please? Pin
New Student29-Mar-05 14:37
New Student29-Mar-05 14:37 
QuestionPlease help. Is multimap what I need? Pin
knapak29-Mar-05 12:58
knapak29-Mar-05 12:58 
AnswerRe: Please help. Is multimap what I need? Pin
BadJerry29-Mar-05 23:47
BadJerry29-Mar-05 23:47 
Hi,

If your data is in memory, yes it is a multimap you need. You fill it like this:
typedef multimap<int,int> mmapint ;
mmapint mapData;
mapData.insert(mmapint::value_type(1,8));
mapData.insert(mmapint::value_type(1,5));
...


To find the data,use this
vector<int> vecResults;
mmapint::const_iterator iteWhere = mapData.find(nSearchedValue);
while ( iteWhere != mapData.end() )
{
	if ( iteWhere->first != nSearchedValue)
		break;
	vecResults.push_back(iteWhere->second);
	iteWhere++;
}


Now, if each time you are going to do a search, you are reading the whole file into memory, you might as well collect the information as you read it... And if your file is sorted, then you should probably do a search by doing successive seeks and halfing the extent of your search... moving to the first one and iterate until you find all of them.

Hope this helps!
GeneralRe: Please help. Is multimap what I need? Pin
knapak30-Mar-05 10:50
knapak30-Mar-05 10:50 
AnswerRe: Please help. Is multimap what I need? Pin
Blake Miller30-Mar-05 4:23
Blake Miller30-Mar-05 4:23 
GeneralRe: Please help. Is multimap what I need? Pin
knapak30-Mar-05 10:50
knapak30-Mar-05 10:50 
GeneralProblem with SetWindowsHookEx() Pin
Dev57829-Mar-05 12:40
Dev57829-Mar-05 12:40 
GeneralRe: Problem with SetWindowsHookEx() Pin
Dev57830-Mar-05 3:57
Dev57830-Mar-05 3:57 
GeneralHINSTANCE requirement Pin
Luther Baker29-Mar-05 11:02
Luther Baker29-Mar-05 11:02 
GeneralRe: HINSTANCE requirement (partial answer only) Pin
David Nash30-Mar-05 14:09
David Nash30-Mar-05 14:09 
GeneralRe: HINSTANCE requirement (partial answer only) Pin
Luther Baker31-Mar-05 9:17
Luther Baker31-Mar-05 9:17 
GeneralRe: HINSTANCE requirement (partial answer only) Pin
David Nash31-Mar-05 20:28
David Nash31-Mar-05 20:28 
GeneralRepaint Dialogs Pin
HackPrince29-Mar-05 10:53
HackPrince29-Mar-05 10:53 
GeneralRe: Repaint Dialogs Pin
David Crow29-Mar-05 11:07
David Crow29-Mar-05 11:07 
GeneralRe: Repaint Dialogs Pin
HackPrince29-Mar-05 11:41
HackPrince29-Mar-05 11:41 
GeneralRe: Repaint Dialogs Pin
HackPrince29-Mar-05 11:43
HackPrince29-Mar-05 11:43 
GeneralRe: Repaint Dialogs Pin
David Crow30-Mar-05 5:19
David Crow30-Mar-05 5:19 
Generalmap keystroke to a string in wordpad application Pin
kristna29-Mar-05 9:09
kristna29-Mar-05 9:09 
GeneralRe: map keystroke to a string in wordpad application Pin
David Crow29-Mar-05 11:12
David Crow29-Mar-05 11:12 
GeneralRe: map keystroke to a string in wordpad application Pin
kristna30-Mar-05 10:22
kristna30-Mar-05 10:22 

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.