Click here to Skip to main content
15,914,447 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncalling API in driver Pin
zon_cpp8-Sep-07 0:05
zon_cpp8-Sep-07 0:05 
QuestionShared Dll to Static Lib Pin
shakumar_227-Sep-07 21:12
shakumar_227-Sep-07 21:12 
AnswerRe: Shared Dll to Static Lib Pin
Cedric Moonen7-Sep-07 23:22
Cedric Moonen7-Sep-07 23:22 
QuestionHow to begin DirectX Pin
kcynic7-Sep-07 20:59
kcynic7-Sep-07 20:59 
AnswerRe: How to begin DirectX Pin
Nishad S8-Sep-07 0:57
Nishad S8-Sep-07 0:57 
GeneralRe: How to begin DirectX Pin
kcynic8-Sep-07 2:16
kcynic8-Sep-07 2:16 
Questionkernel mode dll Pin
samira forooghi7-Sep-07 19:44
samira forooghi7-Sep-07 19:44 
QuestionSome ambiguities with MFC CString class. [modified] Pin
Hamed Musavi7-Sep-07 19:20
Hamed Musavi7-Sep-07 19:20 
2 problems:

1. The following code, has memory leak. (Not in m_pA and pStr, since I delete them later):

in .h
struct a
{
  char* pStr;
};
a* m_pA;

in .cpp
m_pA = new a;
.
.
.
// Now in a thread

m_pA->pStr = new char[260];
CString szPath = m_pA->pStr;

// Now I use szPath ( say for TRACE )
...
// And then delete the newed char* buffer
delete[] m_pA->pStr;
.
.
.
// Finally later in destructor I delete the only instance of my structure
delete m_pA;

unless I call szPath.Empty() before exiting. why?

2. Is it safe to use CString as a member of a struct and pass it to a function? with the un-predefined size of the CString how stack looks like in the function?

Thank you so much in advanced.





-- modified at 1:28 Saturday 8th September, 2007
-- modified at 10:13 Saturday 8th September, 2007
I added delete calls, since no one trusted me when at first line I mentioned I delete them later(or perhaps no one ever read the very first line;P)

// "Life is very short and is very fragile also." Yanni
while (I'm_alive)
{
cout<<"I love programming.";
}

AnswerRe: Some ambigituies with MFC CString class. Pin
chandu0047-Sep-07 19:26
chandu0047-Sep-07 19:26 
GeneralRe: Some ambigituies with MFC CString class. Pin
Hamed Musavi7-Sep-07 19:36
Hamed Musavi7-Sep-07 19:36 
GeneralRe: Some ambigituies with MFC CString class. Pin
Cedric Moonen7-Sep-07 22:57
Cedric Moonen7-Sep-07 22:57 
AnswerRe: Some ambiguities with MFC CString class. Pin
progDes7-Sep-07 20:26
progDes7-Sep-07 20:26 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi7-Sep-07 20:53
Hamed Musavi7-Sep-07 20:53 
AnswerRe: Some ambiguities with MFC CString class. Pin
progDes7-Sep-07 22:29
progDes7-Sep-07 22:29 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi8-Sep-07 4:11
Hamed Musavi8-Sep-07 4:11 
AnswerRe: Some ambiguities with MFC CString class. Pin
John R. Shaw7-Sep-07 22:07
John R. Shaw7-Sep-07 22:07 
GeneralRe: Some ambiguities with MFC CString class. [modified] Pin
Hamed Musavi8-Sep-07 4:08
Hamed Musavi8-Sep-07 4:08 
AnswerRe: Some ambiguities with MFC CString class. Pin
bob169728-Sep-07 4:36
bob169728-Sep-07 4:36 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi8-Sep-07 4:41
Hamed Musavi8-Sep-07 4:41 
GeneralRe: Some ambiguities with MFC CString class. Pin
progDes8-Sep-07 6:05
progDes8-Sep-07 6:05 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi8-Sep-07 18:45
Hamed Musavi8-Sep-07 18:45 
AnswerRe: Some ambiguities with MFC CString class. Pin
Mark Salsbery8-Sep-07 6:42
Mark Salsbery8-Sep-07 6:42 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi8-Sep-07 9:04
Hamed Musavi8-Sep-07 9:04 
GeneralRe: Some ambiguities with MFC CString class. Pin
Mark Salsbery8-Sep-07 10:59
Mark Salsbery8-Sep-07 10:59 
GeneralRe: Some ambiguities with MFC CString class. Pin
Hamed Musavi8-Sep-07 15:53
Hamed Musavi8-Sep-07 15:53 

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.