Click here to Skip to main content
15,902,189 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: About Memory initialization Pin
Raj Prathap6-Nov-07 23:52
Raj Prathap6-Nov-07 23:52 
AnswerRe: About Memory initialization Pin
jhwurmbach6-Nov-07 23:56
jhwurmbach6-Nov-07 23:56 
GeneralRe: About Memory initialization Pin
toxcct7-Nov-07 0:11
toxcct7-Nov-07 0:11 
GeneralRe: About Memory initialization Pin
jhwurmbach7-Nov-07 0:35
jhwurmbach7-Nov-07 0:35 
GeneralRe: About Memory initialization Pin
Nemanja Trifunovic7-Nov-07 3:48
Nemanja Trifunovic7-Nov-07 3:48 
GeneralRe: About Memory initialization Pin
jhwurmbach7-Nov-07 3:52
jhwurmbach7-Nov-07 3:52 
GeneralRe: About Memory initialization Pin
Nemanja Trifunovic7-Nov-07 4:17
Nemanja Trifunovic7-Nov-07 4:17 
GeneralRe: About Memory initialization Pin
Matthew Faithfull6-Nov-07 23:58
Matthew Faithfull6-Nov-07 23:58 
The short answer is you can't.
The long answer is:-
You can use a pre-written class like std::string or CString instead of a plain character array but somewhere underneath the neat interface new will be in use if you change the memory size you require at runtime.
One alternative is to fix n but to make it large enough that there won't be a problem. e.g.
char str[1024];
This is always risky and can be wasteful but may be the right solution in some cases.
Another approach is to use BSTRs otherwise known as Bee Stings because they can be very painful. SysAllocString and realted APIs use some special Win32 magic, probably involving reserved memory or non-paged pool to do memory operations faster than ordinary new and delete. If you dig around CP and elsewhere you might even find a string class that uses BSTRs internally but has a nice easy to use CString like interface. It will still likely be less efficient than using plain character arrays though if raw speed is all you're after.

Nothing is exactly what it seems but everything with seems can be unpicked.

GeneralRe: About Memory initialization Pin
toxcct7-Nov-07 0:13
toxcct7-Nov-07 0:13 
AnswerRe: About Memory initialization Pin
toxcct7-Nov-07 0:08
toxcct7-Nov-07 0:08 
AnswerRe: About Memory initialization Pin
John R. Shaw7-Nov-07 0:56
John R. Shaw7-Nov-07 0:56 
QuestionHow to make a connection to MySQL in MFC? Pin
TooShy2Talk6-Nov-07 23:15
TooShy2Talk6-Nov-07 23:15 
QuestionRe: How to make a connection to MySQL in MFC? Pin
David Crow7-Nov-07 4:37
David Crow7-Nov-07 4:37 
AnswerRe: How to make a connection to MySQL in MFC? Pin
TooShy2Talk7-Nov-07 14:37
TooShy2Talk7-Nov-07 14:37 
QuestionRe: How to make a connection to MySQL in MFC? Pin
David Crow8-Nov-07 2:41
David Crow8-Nov-07 2:41 
QuestionDYNCALL(writeData)((UCHAR *) Pin
doc606-Nov-07 22:59
doc606-Nov-07 22:59 
AnswerRe: DYNCALL(writeData)((UCHAR *) Pin
Matthew Faithfull6-Nov-07 23:08
Matthew Faithfull6-Nov-07 23:08 
GeneralCompilation on dual-core Pin
hairy_hats6-Nov-07 22:37
hairy_hats6-Nov-07 22:37 
GeneralRe: Compilation on dual-core Pin
Matthew Faithfull6-Nov-07 23:00
Matthew Faithfull6-Nov-07 23:00 
GeneralRe: Compilation on dual-core Pin
hairy_hats6-Nov-07 23:04
hairy_hats6-Nov-07 23:04 
GeneralRe: Compilation on dual-core Pin
Matthew Faithfull6-Nov-07 23:15
Matthew Faithfull6-Nov-07 23:15 
QuestionRe: Compilation on dual-core Pin
David Crow7-Nov-07 4:40
David Crow7-Nov-07 4:40 
AnswerRe: Compilation on dual-core Pin
hairy_hats7-Nov-07 4:43
hairy_hats7-Nov-07 4:43 
QuestionAnother CAsyncSocket Problem Pin
TheInfernalCrow6-Nov-07 22:04
TheInfernalCrow6-Nov-07 22:04 
GeneralRe: Another CAsyncSocket Problem Pin
Matthew Faithfull6-Nov-07 22:45
Matthew Faithfull6-Nov-07 22: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.