Click here to Skip to main content
16,005,037 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: User Tokens Pin
Perspx25-Aug-07 14:36
Perspx25-Aug-07 14:36 
GeneralRe: User Tokens Pin
Richard Andrew x6425-Aug-07 14:55
professionalRichard Andrew x6425-Aug-07 14:55 
GeneralRe: User Tokens Pin
Perspx25-Aug-07 23:36
Perspx25-Aug-07 23:36 
Questionhow to use LPSTR* Pin
nitin324-Aug-07 20:41
nitin324-Aug-07 20:41 
AnswerRe: how to use LPSTR* Pin
Waldermort24-Aug-07 22:20
Waldermort24-Aug-07 22:20 
GeneralRe: how to use LPSTR* Pin
bob1697225-Aug-07 5:48
bob1697225-Aug-07 5:48 
GeneralRe: how to use LPSTR* Pin
bob1697225-Aug-07 6:13
bob1697225-Aug-07 6:13 
AnswerRe: how to use LPSTR* [modified] Pin
bob1697225-Aug-07 6:07
bob1697225-Aug-07 6:07 
<blockquote class="FQ"><div class="FQA">nitinmx wrote:</div>BOOL SomeFunc( LPSTR* arString )</blockquote>

LPSTR* is a pointer to a pointer. I am assuming you want the function to allocate some memory and modify your pointer to point to it. If this is what your after, here's a sample...



int CTestPPView::SomeFunc(LPSTR* pPointer)
{
ASSERT(pPointer);
ASSERT(*pPointer==NULL);

char* pString="This is a test";
int nLength=strlen(pString)+1; // Add one for null terminator

// Modify the passed in pointer to point to allocation
*pPointer=new char[nLength];

if (*pPointer) {

strncpy(*pPointer,pString,nLength); // Copy some string to it
return nLength;
}

return -1; // Error
}

// In some method elsewhere...

LPSTR lpString=NULL;
int nLength=SomeFunc(&lpString);

if (lpString) {
TRACE("%s\n",lpString); // Just to display in debug

delete[] lpString;
}


-- modified at 12:14 Saturday 25th August, 2007

UPDATE: Now that I reread your post, I realize LPSTR* is not correct for what you are apparently trying to do. Waldermort appears to have interpreted correctly what you are asking for so just ignore my post.
Questionhow to Use Coloured Dialog Box Pin
GauranG Shah24-Aug-07 19:10
GauranG Shah24-Aug-07 19:10 
AnswerRe: how to Use Coloured Dialog Box Pin
nitin324-Aug-07 20:04
nitin324-Aug-07 20:04 
QuestionVC6 MFC serial port Pin
elegantcharm24-Aug-07 10:33
elegantcharm24-Aug-07 10:33 
QuestionHow do you determine who loaded a DLL? Pin
Joe Woodbury24-Aug-07 8:11
professionalJoe Woodbury24-Aug-07 8:11 
AnswerRe: How do you determine who loaded a DLL? Pin
Bob Nadler25-Aug-07 10:30
Bob Nadler25-Aug-07 10:30 
GeneralRe: How do you determine who loaded a DLL? Pin
Joe Woodbury25-Aug-07 13:49
professionalJoe Woodbury25-Aug-07 13:49 
GeneralRe: How do you determine who loaded a DLL? Pin
Perspx25-Aug-07 14:23
Perspx25-Aug-07 14:23 
GeneralRe: How do you determine who loaded a DLL? Pin
Joe Woodbury25-Aug-07 23:05
professionalJoe Woodbury25-Aug-07 23:05 
GeneralRe: How do you determine who loaded a DLL? Pin
Perspx25-Aug-07 23:35
Perspx25-Aug-07 23:35 
GeneralRe: How do you determine who loaded a DLL? Pin
David Crow27-Aug-07 3:21
David Crow27-Aug-07 3:21 
GeneralRe: How do you determine who loaded a DLL? Pin
Joe Woodbury27-Aug-07 5:55
professionalJoe Woodbury27-Aug-07 5:55 
AnswerRe: How do you determine who loaded a DLL? Pin
cmk28-Aug-07 2:20
cmk28-Aug-07 2:20 
GeneralRe: How do you determine who loaded a DLL? Pin
Joe Woodbury28-Aug-07 5:50
professionalJoe Woodbury28-Aug-07 5:50 
GeneralRe: How do you determine who loaded a DLL? Pin
cmk28-Aug-07 12:23
cmk28-Aug-07 12:23 
Question[VC8 MFC] How is it possible to set the font color for an Edit Control and Static Text ? Pin
abiemann24-Aug-07 6:35
abiemann24-Aug-07 6:35 
AnswerRe: [VC8 MFC] How is it possible to set the font color for an Edit Control and Static Text ? Pin
Mark Salsbery24-Aug-07 7:10
Mark Salsbery24-Aug-07 7:10 
GeneralRe: [VC8 MFC] How is it possible to set the font color for an Edit Control and Static Text ? Pin
abiemann24-Aug-07 8:20
abiemann24-Aug-07 8:20 

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.