Click here to Skip to main content
15,906,097 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Totally confused with memory alocation for '_get_pgmptr' function Pin
KaЯl25-Jun-07 22:48
KaЯl25-Jun-07 22:48 
GeneralRe: Totally confused with memory alocation for '_get_pgmptr' function Pin
Hamed Musavi26-Jun-07 2:19
Hamed Musavi26-Jun-07 2:19 
GeneralRe: Totally confused with memory alocation for '_get_pgmptr' function Pin
KaЯl26-Jun-07 2:39
KaЯl26-Jun-07 2:39 
QuestionWhat is the error in this code fragment Pin
xbiju25-Jun-07 21:16
xbiju25-Jun-07 21:16 
AnswerRe: What is the error in this code fragment Pin
Hamed Musavi25-Jun-07 21:33
Hamed Musavi25-Jun-07 21:33 
AnswerRe: What is the error in this code fragment Pin
Hamid_RT25-Jun-07 22:28
Hamid_RT25-Jun-07 22:28 
AnswerRe: What is the error in this code fragment Pin
Mark Salsbery26-Jun-07 7:08
Mark Salsbery26-Jun-07 7:08 
QuestionTab Order Pin
_anil_25-Jun-07 20:37
_anil_25-Jun-07 20:37 
AnswerRe: Tab Order Pin
Hamed Musavi25-Jun-07 21:54
Hamed Musavi25-Jun-07 21:54 
GeneralRe: Tab Order Pin
Hamid_RT25-Jun-07 22:32
Hamid_RT25-Jun-07 22:32 
GeneralRe: Tab Order Pin
Hamed Musavi25-Jun-07 22:41
Hamed Musavi25-Jun-07 22:41 
AnswerRe: Tab Order Pin
Hamid_RT25-Jun-07 22:21
Hamid_RT25-Jun-07 22:21 
GeneralRe: Tab Order Pin
_anil_25-Jun-07 23:19
_anil_25-Jun-07 23:19 
QuestionResizing list control with splitter and window Pin
neha.agarwal2725-Jun-07 20:20
neha.agarwal2725-Jun-07 20:20 
AnswerRe: Resizing list control with splitter and window Pin
_anil_25-Jun-07 20:42
_anil_25-Jun-07 20:42 
GeneralRe: Resizing list control with splitter and window Pin
neha.agarwal2725-Jun-07 21:08
neha.agarwal2725-Jun-07 21:08 
QuestionRe: Resizing list control with splitter and window Pin
Rajkumar R25-Jun-07 21:29
Rajkumar R25-Jun-07 21:29 
GeneralRe: Resizing list control with splitter and window Pin
_anil_25-Jun-07 21:56
_anil_25-Jun-07 21:56 
Questionhow to split a dialog box? Pin
vikramkarthik25-Jun-07 18:52
vikramkarthik25-Jun-07 18:52 
QuestionRe: how to split a dialog box? Pin
Perspx25-Jun-07 19:57
Perspx25-Jun-07 19:57 
AnswerRe: how to split a dialog box? Pin
Hamid_RT25-Jun-07 22:36
Hamid_RT25-Jun-07 22:36 
QuestionDeclare string array in heap Pin
Aqueel25-Jun-07 18:05
Aqueel25-Jun-07 18:05 
AnswerRe: Declare string array in heap Pin
John R. Shaw25-Jun-07 20:27
John R. Shaw25-Jun-07 20:27 
AnswerRe: Declare string array in heap Pin
CPallini25-Jun-07 20:56
mveCPallini25-Jun-07 20:56 
Of course it depends on what you choose as a suitable string. For instance C-like strings are simply (NULL-terminated) character arrays, hence you can do something like:
char ** myStringArray;
myStringArray = new char * [3];
myStringArray[0] = "hello world";
myStringArray[1] = new char[10];
memset(myStringArray[1], '*',9);
myStringArray[1][9]='\0';
myStringArray[2] = strdup("Hi");
//Clean-up
delete [] myStringArray[1];
free (myStringArray[2]);
delete [] myStringArray;


On the other hand, MFC CString or std::string are objects controlling themselves the inner character buffer, therefore you can do, for instance:
CString * myStringArray;
myStringArray = new CString[2];
myStringArray[0]="Hello World";
myStringArray[0] += "!";// note CString dynamically controls its buffer
myStringArray[1]=CString('*',9);

// Clean-Up
delete [] myStringArray;


Hope that helps
Smile | :)

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

QuestionWhat an I doing wrong with swprintf() Pin
frqftgbdafr25-Jun-07 17:23
frqftgbdafr25-Jun-07 17:23 

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.