|
It looks like your sample is an example of why std:::string should be used: The null terminator will overflow the char[] buffers you allocated by one byte.
|
|
|
|
|
You're wrong.
Hint: I didn't use strlen .
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Does the memory for those strings necessarily need to come from the heap? If not, what about:
char *ptr_p_c[] = { "hi there", "whatever" };
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
piul wrote: Believe me, I've tried repeatedly to convince my customer this is not the right way to do things, but unfortunately it is not my decission...
If you are a professional, then MAKE IT your decision.
if it takes less time to develop, less time to debug, make the code more secure and readable, than you need to do it the right way.
anyway,you should delete each item in the ptr_p_c array.
good luck.
Watched code never compiles.
|
|
|
|
|
piul wrote: Believe me, I've tried repeatedly to convince my customer this is not the right way to do things
Why does the customer need to know how you are implementing a small piece of code? If they understand that level of detail then why do they need you?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Because he's afraid of using new for instancing strings.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I know dumb customers.
I also know dumber customers.
But this is the dumbest customer.
|
|
|
|
|
You know dumb customers.
I know dumb customers.
He knows dumb customers.
Hey Superman, your customers.
Hey Superman, YOUR customers
are just not that dumb.
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
So dumb customers are your kryptonite, eh?
|
|
|
|
|
A good reason to dislike them.
|
|
|
|
|
Hi,
I am using MFC with two dialog box. One dialog box have text box and submit button. once i type some text and submit this button, how to get values from another dialog box?
any sample pls share
Regards,
M.Mathivanan
|
|
|
|
|
If they are both modal dialogs then you need to run the first dialog, save the data after it completes, then run the seond and use the values from the first as required.
Or did I misunderstand your question?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I'm not sure if I correctly understand the question but I suppose you have some problems with dialog data exchange (DDX) architecture. If this is the case check out this[^] and this[^] MSDN pages.
Also have a look at this[^] example. I believe it can be useful for you.
|
|
|
|
|
There's a nice article written by toxcct, here at CodeProject: Dialogs Communication[^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Are the dialog boxes "peers" or "subordinates?" It's much the same either way, but it might help to clarify your question if you provided such details.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
I need to draw shadow aroung the rounded dialog, How can I do that?
|
|
|
|
|
First, have a look at this[^] article.
Another option is using CS_DROPSHADOW class but it requires a Windows version >= XP.
And finally, check out this[^] article.
Choose the most appropriate approach for you.
|
|
|
|
|
To Get the Current UserName and HostName in vc++ mfc
char host[200];
gethostname(host,201);
CString str,user;
str=host;
TCHAR acUserName[100];
DWORD nUserName = sizeof(acUserName);
GetUserName(acUserName, &nUserName);
user=acUserName;
Regards,
N.GokulNath
|
|
|
|
|
Please do not re post the same question...
I believe in LOVE AT FIRST SITE...
Bcoz I have loved my Mother...
even since I opened my eyes...(ICAN)
|
|
|
|
|
And your question is?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
Urgent
I'm current a full-time student doing my Final-Year Project.
I seeking for H.E.L.P and C.O.A.C.H.I.N.G Badly
Requirements:
I was assigned to come out a program using Visual C++ to communicate with HyperTerminal thru RS232 Serial Cable.
PC(1) opens Hyperterminal to send text to PC(2) which opens Visual C++, a program to receive the text and able to view the text on the screen thru a RS232, Null Modem Cable - Serial Communication.
Progress:
what I had done so far is only allowing me open Visual C++ PC(2) to send text to PC(1) Hyperterminal instead in another way on the requirements I need as mentioned above.
Regards,
david
|
|
|
|
|
Please use cross serial cable.
and communication setting should be same.
eg: baudrate , parity, stop bit etc.
u can use either hyperterminal or Look Rs232.
my suggestion is that please use Look RS232.it gives more option to see send and receive data.
|
|
|
|
|
Thanks on your recommentation..
on your recommentation, does that apply on coming out a program using Visual C++ to receive the text from Hyperterminal?
|
|
|
|
|
FYI: I have been using this virtual null modem[^] successfully; it allows you to run both programs on the same computer, having each of them use a virtual serial port which get interconnected using the virtual null modem. So you no longer need two PC systems...
|
|
|
|