Click here to Skip to main content
15,927,699 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionMultithread Prime Directive Compliance [modified] Pin
quasinormalized6-Jul-06 12:22
quasinormalized6-Jul-06 12:22 
AnswerRe: Multithread Prime Directive Compliance Pin
Gary R. Wheeler6-Jul-06 14:52
Gary R. Wheeler6-Jul-06 14:52 
GeneralRe: Multithread Prime Directive Compliance Pin
Ryan Binns6-Jul-06 19:20
Ryan Binns6-Jul-06 19:20 
GeneralRe: Multithread Prime Directive Compliance Pin
quasinormalized7-Jul-06 4:58
quasinormalized7-Jul-06 4:58 
QuestionProblem with alphablending Pin
Luksky6-Jul-06 11:17
Luksky6-Jul-06 11:17 
AnswerRe: Problem with alphablending Pin
Hamid_RT6-Jul-06 19:20
Hamid_RT6-Jul-06 19:20 
QuestionWhy do we need heap allocation? [modified] Pin
sawerr6-Jul-06 11:07
sawerr6-Jul-06 11:07 
AnswerRe: Why do we need heap allocation? Pin
Chris Losinger6-Jul-06 11:25
professionalChris Losinger6-Jul-06 11:25 
sawerr wrote:
I want to allocate memory dynamicly(unknown size until runtime) in heap with new.How can i do this?


you can not allocate an unknown amount of memory. you must specify an amount when you do the allocation.

the easiest way to handle the problem is to use a string class (like std::string) that can handle the allocation for you, automatically:

#include < string >
...
std::string mytext;
cout << "Enter name";
cin >> mytext;
cout << mytext;


why do you new dynamic allocation? you need it so you can allocate memory that is larger than the size of the stack. you can also use it so that subroutines can allocate objects and variables whose number and/or size are unknown to the caller at compile-time.


Cleek | Image Toolkits | Thumbnail maker

GeneralRe: Why do we need heap allocation? Pin
sawerr6-Jul-06 11:44
sawerr6-Jul-06 11:44 
GeneralRe: Why do we need heap allocation? [modified] Pin
Chris Losinger6-Jul-06 12:07
professionalChris Losinger6-Jul-06 12:07 
GeneralRe: Why do we need heap allocation? Pin
sawerr6-Jul-06 12:30
sawerr6-Jul-06 12:30 
GeneralRe: Why do we need heap allocation? Pin
Chris Losinger6-Jul-06 15:24
professionalChris Losinger6-Jul-06 15:24 
QuestionClass exported from a DLL Pin
Jay036-Jul-06 10:55
Jay036-Jul-06 10:55 
AnswerRe: Class exported from a DLL Pin
led mike6-Jul-06 11:15
led mike6-Jul-06 11:15 
GeneralRe: Class exported from a DLL Pin
Jay036-Jul-06 11:41
Jay036-Jul-06 11:41 
QuestionLooking for a C++ programmer Pin
roland516-Jul-06 10:31
roland516-Jul-06 10:31 
AnswerRe: Looking for a C++ programmer Pin
led mike6-Jul-06 10:49
led mike6-Jul-06 10:49 
GeneralRe: Looking for a C++ programmer Pin
ThatsAlok6-Jul-06 18:45
ThatsAlok6-Jul-06 18:45 
AnswerRe: Looking for a C++ programmer Pin
peterchen6-Jul-06 10:54
peterchen6-Jul-06 10:54 
AnswerRe: Looking for a C++ programmer [modified] Pin
Joe Woodbury6-Jul-06 12:20
professionalJoe Woodbury6-Jul-06 12:20 
AnswerRe: Looking for a C++ programmer Pin
John M. Drescher6-Jul-06 15:56
John M. Drescher6-Jul-06 15:56 
QuestionProblems with throw exception definition in comutil.h Pin
Alex Cutovoi6-Jul-06 8:30
Alex Cutovoi6-Jul-06 8:30 
AnswerRe: Problems with throw exception definition in comutil.h Pin
Zac Howland6-Jul-06 9:42
Zac Howland6-Jul-06 9:42 
GeneralRe: Problems with throw exception definition in comutil.h Pin
Alex Cutovoi6-Jul-06 9:49
Alex Cutovoi6-Jul-06 9:49 
GeneralRe: Problems with throw exception definition in comutil.h Pin
Zac Howland6-Jul-06 10:45
Zac Howland6-Jul-06 10:45 

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.