Click here to Skip to main content
15,916,318 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: Serializing objects using XLM Pin
Ernesto D.5-Apr-05 2:34
Ernesto D.5-Apr-05 2:34 
GeneralSmart Tag for Rich Edit of Outlook email viewer Pin
Rajeev K Srivastava3-Apr-05 9:35
Rajeev K Srivastava3-Apr-05 9:35 
GeneralCan't get data from my vector. Help!!! Pin
Larry Mills Sr2-Apr-05 9:42
Larry Mills Sr2-Apr-05 9:42 
GeneralBrowser Helper Object Pin
nmhuy30-Mar-05 21:42
nmhuy30-Mar-05 21:42 
GeneralRe: Browser Helper Object Pin
Nicholas Cardi1-Apr-05 4:00
Nicholas Cardi1-Apr-05 4:00 
GeneralProblem while Persisting Image into Control Pin
ajalilqarshi30-Mar-05 3:58
ajalilqarshi30-Mar-05 3:58 
GeneralMultiple Inclusion Pin
Gomzy29-Mar-05 22:09
sussGomzy29-Mar-05 22:09 
QuestionPlease help. Is multimap what I need? Pin
knapak29-Mar-05 13:37
knapak29-Mar-05 13:37 
Hi-- I've been banging my head trying to solve this problem. Of course I'm a self trained pseudo programmer who just started to use STL. I have a huge file with 10 million entries that are paired, say:
1 8
1 5
1 3
2 0
2 4
3 0
3 8
etc...
They are stored as a two dimensional array of 10 million rows and two columns... you get the idea of the data. I need to find the records in the file that have one and only one of the tags in the first entry of the pair and put the second in another vector file in the order found. For example, if I need records with the tag 2, I'll create the vector
0
4
I suppose I need to use a multimap, but do not know how to read the file and then store the results in a vector. Right now I have this simple code:

typedef vector DVECTOR;
DVECTOR FDV;
int tag;
double FD;
int id = 3;
int idp = id + 1;

while(tag != idp)
{
GetData >> tag >> FD;
cout << tag << " " << FD << endl ;
if(tag == id)
FDV.push_back(FD);
}

This does what I want by scaning the file from the begining until it finds the target value and reads all the entries with such value. If the number is close to the first entry, cool it's fast, but if it is near the end it will take a long time (big program repeated many times...). The question is, would the multimap work better and faster to do the same task? If so... how do I do it??? that is, read the file, store the data in a multimap, search for the tag number of my interest and copy all values associated to the tag number into a vector. If I have to read the whole 10 million line file to put it in a map, then it's going to be hanging around in memory for further use (several times)... or should I read the file every time I need it?? If so, then, isn't my naive code more efficient???

By the way, I'm trying this other code using multimap but gives me horrible error messages:

typedef multimap<int, double=""> DMMAP;
DMMAP mapfish;
while(!GetData.eof())
{
GetData >> tag >> FDS;
mapfish.insert(make_pair(tag,FDS));
}

argggggggggggggggggggggggggg Dead | X|

Thank you so much!

Carlos
AnswerRe: Please help. Is multimap what I need? Pin
Joaquín M López Muñoz30-Mar-05 6:27
Joaquín M López Muñoz30-Mar-05 6:27 
GeneralRe: Please help. Is multimap what I need? Pin
knapak30-Mar-05 11:44
knapak30-Mar-05 11:44 
GeneralCString to &lt;string&gt; help please.. Pin
mlatimer28-Mar-05 19:25
mlatimer28-Mar-05 19:25 
GeneralRe: CString to &lt;string&gt; help please.. Pin
rwestgraham29-Mar-05 14:32
rwestgraham29-Mar-05 14:32 
QuestionHow to Access properties of Control? Pin
ajalilqarshi28-Mar-05 19:01
ajalilqarshi28-Mar-05 19:01 
General[wtl] Making a Wizard-Only app Pin
Member 1219625228-Mar-05 2:12
Member 1219625228-Mar-05 2:12 
GeneralRe: [wtl] Making a Wizard-Only app Pin
Ernesto D.4-Apr-05 14:55
Ernesto D.4-Apr-05 14:55 
Generalcomponents with multiple interfaces Pin
yqzq27-Mar-05 22:14
yqzq27-Mar-05 22:14 
GeneralEvent Threading Pin
zx2c426-Mar-05 16:32
zx2c426-Mar-05 16:32 
GeneralRe: Event Threading Pin
Nicholas Cardi1-Apr-05 4:08
Nicholas Cardi1-Apr-05 4:08 
QuestionIsn't it possible to Persist SAFEARRAYs? Pin
ajalilqarshi25-Mar-05 22:18
ajalilqarshi25-Mar-05 22:18 
AnswerRe: Isn't it possible to Persist SAFEARRAYs? Pin
Michael Dunn26-Mar-05 9:56
sitebuilderMichael Dunn26-Mar-05 9:56 
GeneralRe: Isn't it possible to Persist SAFEARRAYs? Pin
ajalilqarshi27-Mar-05 19:15
ajalilqarshi27-Mar-05 19:15 
GeneralCustom ActiveX control Pin
foxyspy24-Mar-05 20:20
foxyspy24-Mar-05 20:20 
QuestionHow to lock child window from resizing in MDI ? Pin
Mandalay24-Mar-05 19:35
Mandalay24-Mar-05 19:35 
AnswerRe: How to lock child window from resizing in MDI ? Pin
Pharago22-Apr-05 1:29
Pharago22-Apr-05 1:29 
Generalhash_map iterator error Pin
ravjak20-Mar-05 21:51
ravjak20-Mar-05 21:51 

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.