Click here to Skip to main content
16,013,322 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Detecting Microphone Input Pin
Mark Salsbery29-Apr-07 8:30
Mark Salsbery29-Apr-07 8:30 
GeneralRe: Detecting Microphone Input Pin
selmak29-Apr-07 10:43
selmak29-Apr-07 10:43 
QuestionHow can i get access to the base object in ActiveX develop ? Pin
Yanshof28-Apr-07 16:53
Yanshof28-Apr-07 16:53 
QuestionDynamic memory allocation, C Pin
C_Zealot28-Apr-07 16:30
C_Zealot28-Apr-07 16:30 
AnswerRe: Dynamic memory allocation, C Pin
Arun.Immanuel28-Apr-07 17:21
Arun.Immanuel28-Apr-07 17:21 
GeneralRe: Dynamic memory allocation, C Pin
C_Zealot28-Apr-07 17:26
C_Zealot28-Apr-07 17:26 
GeneralRe: Dynamic memory allocation, C Pin
John R. Shaw28-Apr-07 21:31
John R. Shaw28-Apr-07 21:31 
AnswerRe: Dynamic memory allocation, C Pin
John R. Shaw28-Apr-07 21:49
John R. Shaw28-Apr-07 21:49 
That will work.

Here is a better design that MS used for years.
typedef struct _wordTable {
    int count;
    char word[1];
} WORDTABLE;

/* allocate every thing at same time */
WORDTABLE *word_ptr = malloc(sizeof(WORDTABLE) + wordSize);
if( word_ptr )
    word_ptr->count = wordSize;


With this method you allocate both at the same time and do not have to add 1, because the extra byte it is part of the structure.

Note: You do not need to multiply by sizeof(char) on most compilers, because it is equal to 1.

INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra

Questionabout event Pin
HOW WHAT28-Apr-07 14:40
HOW WHAT28-Apr-07 14:40 
AnswerRe: about event Pin
Christian Graus28-Apr-07 14:57
protectorChristian Graus28-Apr-07 14:57 
GeneralRe: about event Pin
HOW WHAT28-Apr-07 15:11
HOW WHAT28-Apr-07 15:11 
GeneralRe: about event Pin
Christian Graus28-Apr-07 15:20
protectorChristian Graus28-Apr-07 15:20 
GeneralRe: about event Pin
HOW WHAT29-Apr-07 2:42
HOW WHAT29-Apr-07 2:42 
GeneralRe: about event Pin
Joan M28-Apr-07 23:47
professionalJoan M28-Apr-07 23:47 
GeneralRe: about event Pin
HOW WHAT29-Apr-07 2:44
HOW WHAT29-Apr-07 2:44 
GeneralRe: about event Pin
Joan M29-Apr-07 4:53
professionalJoan M29-Apr-07 4:53 
QuestionMemory handling/Bad practice? Pin
alex.barylski28-Apr-07 12:35
alex.barylski28-Apr-07 12:35 
AnswerRe: Memory handling/Bad practice? Pin
cmk28-Apr-07 12:56
cmk28-Apr-07 12:56 
AnswerRe: Memory handling/Bad practice? Pin
John R. Shaw28-Apr-07 14:42
John R. Shaw28-Apr-07 14:42 
QuestionAutoProxy detection via script "FindProxyForURL" Pin
Peter Weyzen28-Apr-07 11:50
Peter Weyzen28-Apr-07 11:50 
QuestionMSChart in VC++2005 Pin
hahahua28-Apr-07 10:38
hahahua28-Apr-07 10:38 
AnswerRe: MSChart in VC++2005 Pin
hahahua28-Apr-07 16:57
hahahua28-Apr-07 16:57 
AnswerRe: MSChart in VC++2005 Pin
Joan M28-Apr-07 23:50
professionalJoan M28-Apr-07 23:50 
GeneralRe: MSChart in VC++2005 Pin
hahahua29-Apr-07 8:40
hahahua29-Apr-07 8:40 
GeneralRe: MSChart in VC++2005 Pin
Joan M29-Apr-07 8:46
professionalJoan M29-Apr-07 8:46 

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.