Click here to Skip to main content
15,903,388 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: sorting charater array alphabetically Pin
BlackDice19-May-05 5:39
BlackDice19-May-05 5:39 
Questionmulti-monitors? Pin
Anonymous19-May-05 3:05
Anonymous19-May-05 3:05 
AnswerRe: multi-monitors? Pin
Blake Miller19-May-05 5:13
Blake Miller19-May-05 5:13 
GeneralThread - Process synchronization Pin
javi_jmc19-May-05 2:47
javi_jmc19-May-05 2:47 
GeneralRe: Thread - Process synchronization Pin
Alexander M.,19-May-05 4:19
Alexander M.,19-May-05 4:19 
GeneralRe: Thread - Process synchronization Pin
Blake Miller19-May-05 5:22
Blake Miller19-May-05 5:22 
GeneralProblems with std::map Pin
ChemmieBro19-May-05 2:31
ChemmieBro19-May-05 2:31 
GeneralRe: Problems with std::map Pin
Joaquín M López Muñoz19-May-05 3:08
Joaquín M López Muñoz19-May-05 3:08 
Hello ChemmieBro, next time you post here please make sure you check on the "Do not treat <'s as HTML tags" checkbox below the input window: otherwise your <'s and >'s won't show up properly. For the benefit of other readers, I'm reproducing here the definition of m_FileList with the bracket thing right:
std::map<BSTR, ofstream*> m_FileList;
The problem you're having is most likely the following: when you look up an item in std::map, the key you pass is compared against those of the elements stored in the map. So far so good, but in your case it is BSTRs that are used as keys, and these are pointers: so, instead of comparing the contents pointed to by the BSTR, it is the pointer addresses that std::map is taking into account, certainly not what you want. The most straightforward solution is to use as keys another type of objects with the right comparison semantics, like for instance MFC CString or some other wrapper around raw BSTRs.

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Want a Boost forum in Code Project? Vote here[^]!
GeneralRe: Problems with std::map Pin
ChemmieBro19-May-05 3:27
ChemmieBro19-May-05 3:27 
GeneralRe: Problems with std::map Pin
Joaquín M López Muñoz19-May-05 3:34
Joaquín M López Muñoz19-May-05 3:34 
GeneralRe: Problems with std::map Pin
ChemmieBro19-May-05 4:13
ChemmieBro19-May-05 4:13 
Generalvirtual inheritance Pin
SimpleProgramer19-May-05 2:27
SimpleProgramer19-May-05 2:27 
GeneralRe: virtual inheritance Pin
Joaquín M López Muñoz19-May-05 2:56
Joaquín M López Muñoz19-May-05 2:56 
Questionhow to copy and paste a nonregular area of an image Pin
Anonymous19-May-05 1:19
Anonymous19-May-05 1:19 
AnswerRe: how to copy and paste a nonregular area of an image Pin
Chris Losinger19-May-05 3:50
professionalChris Losinger19-May-05 3:50 
Generalfile type associations Pin
gx4419-May-05 0:58
gx4419-May-05 0:58 
GeneralRe: file type associations Pin
Joel Holdsworth19-May-05 1:11
Joel Holdsworth19-May-05 1:11 
QuestionCross Network communication using Winsock2? Pin
arrya_amit19-May-05 0:39
arrya_amit19-May-05 0:39 
AnswerRe: Cross Network communication using Winsock2? Pin
ThatsAlok19-May-05 1:44
ThatsAlok19-May-05 1:44 
Generalsimple installer Pin
dave2k19-May-05 0:16
dave2k19-May-05 0:16 
GeneralRe: simple installer Pin
Jack Puppy19-May-05 0:19
Jack Puppy19-May-05 0:19 
GeneralDAO and ADO in same project Pin
MK7818-May-05 22:47
MK7818-May-05 22:47 
GeneralRe: DAO and ADO in same project Pin
RChin18-May-05 23:49
RChin18-May-05 23:49 
GeneralRe: DAO and ADO in same project Pin
MK7818-May-05 23:59
MK7818-May-05 23:59 
GeneralRe: DAO and ADO in same project Pin
RChin19-May-05 0:22
RChin19-May-05 0: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.