|
Tomasz Sowinski wrote:
v.resize(100);
Thanks Tomasz. I'd like to avoid this step. I dont want to set a start size. I want to create an array and keep inserting stuff into it. Then after I am finished I simply return the array
Is that possible?
I am too tired now to look up MSDN to find out whether push_back does this for me. It probably does.
Regards
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
It probably does.
It certainly does.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
It probably does.
It certainly does.
Thanks Joaq. For a moment I was wondering whether this was grammar class when I saw those two sentences just like that
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
push_back will do. You may consider using v.reserve(n) to avoid buffer reallocations when your vector grows - but this is just an optimization, you don't have do that. BTW: vectors grow expotentially, not linearly like CArray does, so reallocs happen much less frequently.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks Tomasz.
I seriously am having this feeling that I should start lookin up some STL.
CG tried to push me into it once. He tries to do that to everybody, including the doorman and the cook.
Hmmmm. Things do seem so simple when people like you explain it that way. Thanks Tomasz.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
CG tried to push me into it once. He tries to do that to everybody, including the doorman and the cook.
No, I don't. The cook is a moron. You, on the other hand, are a smart guy who is well able to understand something as simple as std::vector.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
The cook is a moron. You, on the other hand, are a smart guy
Hey, thanks. At least I now know I am smarter than the cook. Though that blasted doorman beat me to first spot
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
Is that possible?
You should read my article on std::vector. It does what you wnat it to, and as Thomaz has pointed out, you can use the [] operators to treat it like a dumb array if you desire.
The STL is calling you Nish, don't hold back....
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Christian Graus wrote:
You should read my article on std::vector
I better go read it properly...
Christian Graus wrote:
The STL is calling you Nish, don't hold back
LOL
I was just commenting on this very facet.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=130099&tid=130068#xx130099xx
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Hi Nish! Taking bout code bloat, take for instance the following sample code:
#ifdef USE_VECTOR
#include <vector>
#endif
int main(void)
{
#ifdef USE_VECTOR
std::vector<int> v;
#else
int * v=new int[1000];
#endif
for(int i=0;i<1000;++i){
#ifdef USE_VECTOR
v.push_back(i);
#else
v[i]=i;
#endif
}
#ifdef USE_VECTOR
#else
delete [] v;
#endif
return 0;
} Using std::vector instead of built-in arrays causes the release executable to grow from 20 to 26K. I find this acceptable (you might not).
What really introduces a huge amount of fat into the executables is the iostream library. But this is not part of STL.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks Joaquín. That sure does make sense.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
Hello, I have a weird request from client:
- an application which when running, ad a custom
bitmap in all windows title bar, with a menu for some commands.
I could make a similarity with behavior of WinAmp for this request.
My application is not using MFC.
Can anybody point me on direction??
Regards
|
|
|
|
|
For painting the caption, use WM_NCPAINT. You'll probably have to code the menu yourself if you really want it to appear on the title bar.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi, I want to make a HTTP POST in C++, therefore I use the HttpSendRequest command. But I can't retrieve the html code, I need to bypass the proxy server. Does anyone know how this can be done??
CPPFreak......
|
|
|
|
|
Have a look at <a href="http://msdn.microsoft.com/workshop/networking/wininet/reference/functions/internetsetoption.asp">InternetSetOption</a> with dwOption==INTERNET_OPTION_PROXY .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I've looked at the options, but it still doesn't work. I've also tried different acces types with InternetOpen.
|
|
|
|
|
use chris maunders class here
I added the proxy code
just swipe the whole class
Bryce
|
|
|
|
|
hi
dose anybody know the code to increment text entered in a text box by 1?
Below is what i have done so far
m_copyed=m_typing;
GetDlgItemText(IDC_EDITDATA, m_typing);
m_copyed=m_typing;
{
/////////code needed here
}
SetDlgItemText(IDC_CHANGEDDATA, m_copyed);
Do u think changing each letter to a number adding 1 and then returning the text is possiable? eg abc=123 +1=234 changed back=bcd
|
|
|
|
|
This changes m_copyed in-place (if you need to preserve the contents of m_copyed do first a copy to some other string and perform the changes there):
for(int i=m_copyed.GetLength();i--; )m_copyed.SetAt(i,m_copyed[i]+1);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
That was very helpful
Thankyou
ps could i use the same code to return the values ie. working backwards to get to the orginal text
|
|
|
|
|
Hi!
How can I edit text in ListCtrl.I have only one column.
Thank you very much!
|
|
|
|
|
First, your control has to have the LVS_EDITLABELS stlye. Then handle the messages LVN_BEGINLABELEDIT and LVN_ENDLABELEDIT . Check your documentation for info about what these handlers are supposed to do.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
JySE.com is a new, free open forum for developers. Currently, we are searching for talented individuals to be moderators of our software development categories.
http://www.jyse.com
|
|
|
|
|
What are the moderators for???
Nish
Bow wow wow,
Yippee yo yippee yay,
My miniputt high,
Is now 30 yay.
|
|
|
|
|
forum moderators police the forum and in the beginning assists in answering queries until our forum has a large enough user base. They have the power to edit/move/delete posts and tries to make sure no one is abusing the forum.
|
|
|
|