Click here to Skip to main content
15,909,591 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to master C++ Pin
CPallini23-Aug-16 1:46
mveCPallini23-Aug-16 1:46 
AnswerRe: How to master C++ Pin
Saravanan Sundaresan24-Sep-16 21:32
professionalSaravanan Sundaresan24-Sep-16 21:32 
Questionc++ Pin
Member 1268236611-Aug-16 19:28
Member 1268236611-Aug-16 19:28 
AnswerRe: c++ Pin
Jochen Arndt11-Aug-16 21:42
professionalJochen Arndt11-Aug-16 21:42 
QuestionInconsistentcies Between Win32 and MFC Pin
ForNow11-Aug-16 7:58
ForNow11-Aug-16 7:58 
AnswerRe: Inconsistentcies Between Win32 and MFC Pin
jeron111-Aug-16 9:55
jeron111-Aug-16 9:55 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
ForNow11-Aug-16 10:30
ForNow11-Aug-16 10:30 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
jeron111-Aug-16 10:46
jeron111-Aug-16 10:46 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
ForNow11-Aug-16 11:31
ForNow11-Aug-16 11:31 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
jeron111-Aug-16 12:24
jeron111-Aug-16 12:24 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
ForNow11-Aug-16 15:49
ForNow11-Aug-16 15:49 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
leon de boer12-Aug-16 4:38
leon de boer12-Aug-16 4:38 
GeneralRe: Inconsistentcies Between Win32 and MFC Pin
ForNow12-Aug-16 5:01
ForNow12-Aug-16 5:01 
QuestionC fread to read 512k binary file Pin
Fossi Bluman10-Aug-16 11:57
Fossi Bluman10-Aug-16 11:57 
QuestionRe: C fread to read 512k binary file Pin
David Crow10-Aug-16 16:45
David Crow10-Aug-16 16:45 
AnswerRe: C fread to read 512k binary file Pin
k505411-Aug-16 12:46
mvek505411-Aug-16 12:46 
GeneralRe: C fread to read 512k binary file Pin
David Crow11-Aug-16 16:24
David Crow11-Aug-16 16:24 
AnswerRe: C fread to read 512k binary file Pin
Daniel Pfeffer10-Aug-16 21:15
professionalDaniel Pfeffer10-Aug-16 21:15 
GeneralRe: C fread to read 512k binary file Pin
Fossi Bluman11-Aug-16 1:58
Fossi Bluman11-Aug-16 1:58 
GeneralRe: C fread to read 512k binary file Pin
Daniel Pfeffer11-Aug-16 3:54
professionalDaniel Pfeffer11-Aug-16 3:54 
GeneralRe: C fread to read 512k binary file Pin
Fossi Bluman11-Aug-16 6:56
Fossi Bluman11-Aug-16 6:56 
AnswerRe: C fread to read 512k binary file Pin
Software_Developer20-Aug-16 0:03
Software_Developer20-Aug-16 0:03 
GeneralRe: C fread to read 512k binary file Pin
Fossi Bluman23-Aug-16 6:45
Fossi Bluman23-Aug-16 6:45 
QuestionVector as function return Pin
Donguy19769-Aug-16 15:40
Donguy19769-Aug-16 15:40 
I am working on a C++ application.

In the header file:

C++
typedef vector<CMyInfo*> CMyInfoBachelor;

CMyInfoBachelor* GetBachelorContained (ULONG MyID);


Now in the Cpp file

C++
CMyInfoBachelor* CMyCache::GetBachelorContained (ULONG MyID)
{
    // Lots of things done here

    for (..........)
    {
        CMyInfo* pS = GetMyInfo(RS.Get_UL("ulid",i));
        if (pS)
           pMyInfo->m_pUsedInTheseBachelor->push_back(pS);
    }
    return pMyInfo->m_pUsedInTheseBachelor;
}

The loop goes twice and i can see 2 separate values are been added to the Vector.

But for some reason it's not getting applied.

So if i look at debug window:-

C++
m_pUsedInTheseBachelor->;***First*** has the correct value

m_pUsedInTheseBachelor->;***Last*** doesn't have the correct value, it's bunch of junk.

i.e., the Vector get's populated correctly only on the 1st loop iteration. The 2nd looping doesn't add the correct value to vector.

I am new to vector and have no idea how to fix it.

Also, how to make sure that it return properly?

The code that i tried is as follow:

In Header file:

C++
vector<CMyInfo*> CMyInfoBachelor* GetBachelorContained (ULONG MyID);

And in Cpp file:



C++
vector<CMyInfo*> CMyInfoBachelor* CMyCache::GetBachelorContained (ULONG MyID)
    {
        // Lots of things done here

        for (..........)
        {
            CMyInfo* pS = GetMyInfo(RS.Get_UL("ulid",i));
            if (pS)
               pMyInfo->m_pUsedInTheseBachelor->push_back(pS);
        }
        return pMyInfo->m_pUsedInTheseBachelor;
    }

But i got a bunch of errors.

[edit]
Tidied up the formatting for you.
[/edit]

modified 10-Aug-16 2:52am.

AnswerRe: Vector as function return Pin
Richard MacCutchan9-Aug-16 20:57
mveRichard MacCutchan9-Aug-16 20:57 

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.