Click here to Skip to main content
15,035,283 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: C fread to read 512k binary file Pin
David Crow11-Aug-16 16:24
MemberDavid 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
MemberFossi 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
MemberFossi Bluman11-Aug-16 6:56 
AnswerRe: C fread to read 512k binary file Pin
Software_Developer20-Aug-16 0:03
MemberSoftware_Developer20-Aug-16 0:03 
GeneralRe: C fread to read 512k binary file Pin
Fossi Bluman23-Aug-16 6:45
MemberFossi Bluman23-Aug-16 6:45 
QuestionVector as function return Pin
Donguy19769-Aug-16 15:40
MemberDonguy19769-Aug-16 15:40 
I am working on a C++ application.

In the header file:

typedef vector<CMyInfo*> CMyInfoBachelor;

CMyInfoBachelor* GetBachelorContained (ULONG MyID);


Now in the Cpp file

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:-

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:

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

And in Cpp file:



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 
QuestionAdding Text to the Frame Of a Dialog Pin
ForNow9-Aug-16 4:39
MemberForNow9-Aug-16 4:39 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
jeron19-Aug-16 8:33
Memberjeron19-Aug-16 8:33 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow9-Aug-16 13:07
MemberForNow9-Aug-16 13:07 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
leon de boer9-Aug-16 19:05
Memberleon de boer9-Aug-16 19:05 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 3:47
MemberForNow10-Aug-16 3:47 
SuggestionRe: Adding Text to the Frame Of a Dialog Pin
David Crow10-Aug-16 5:41
MemberDavid Crow10-Aug-16 5:41 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer10-Aug-16 17:07
Memberleon de boer10-Aug-16 17:07 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow10-Aug-16 20:31
MemberForNow10-Aug-16 20:31 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
leon de boer11-Aug-16 3:00
Memberleon de boer11-Aug-16 3:00 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 3:18
MemberForNow11-Aug-16 3:18 
GeneralRe: Adding Text to the Frame Of a Dialog Pin
ForNow11-Aug-16 2:58
MemberForNow11-Aug-16 2:58 
AnswerRe: Adding Text to the Frame Of a Dialog Pin
Richard MacCutchan9-Aug-16 20:49
mveRichard MacCutchan9-Aug-16 20:49 
Questionconst "getter" but updating on request? Pin
FriendOfAsherah8-Aug-16 21:20
MemberFriendOfAsherah8-Aug-16 21:20 
AnswerRe: const "getter" but updating on request? Pin
Jochen Arndt8-Aug-16 23:46
professionalJochen Arndt8-Aug-16 23:46 
GeneralRe: const "getter" but updating on request? Pin
FriendOfAsherah9-Aug-16 2:30
MemberFriendOfAsherah9-Aug-16 2:30 
GeneralRe: const "getter" but updating on request? Pin
Jochen Arndt9-Aug-16 3:03
professionalJochen Arndt9-Aug-16 3:03 

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.