Click here to Skip to main content
       

C / C++ / MFC

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
AnswerRe: Merging ArraysmemberAndy41127 Nov '12 - 22:48 
OK, I had to delete my first answer, because it was a C# solution. Sorry. Now my brain is switsched in C-mode Smile | :)
 
You can use memcpy. But allways be aware of the size of the target array! It has to be large enough to take all of the elements.
 
int a[] = { 2, 4, 6};
int b[] = { 3, 5, 7};
 
int c[6];
 
memcpy(c, a, sizeof(a));
memcpy(c + 3, b, sizeof(b)); // + 3 because the first 3 elements are 
// allready in use
 
Hope it helps.
AnswerRe: Merging ArraysmvpCPallini27 Nov '12 - 23:09 
pix_programmer wrote:
How to do this?
Coding!
 
Another option would be using std::vector, and using the insert[^] method.
Veni, vidi, vici.

JokeRe: Merging ArraysmvpRichard MacCutchan27 Nov '12 - 23:45 
CPallini wrote:
Coding!
Now that's a brilliant idea; who'd a thunk it?
One of these days I'm going to think of a really clever signature.

JokeRe: Merging ArraysmvpCPallini27 Nov '12 - 23:58 
I know I'm an innovator.
Smile | :)
Veni, vidi, vici.

GeneralRe: Merging ArraysmemberDavidCrow28 Nov '12 - 5:36 
CPallini wrote:

Another option would be using std::vector, and using the insert[^] method.
I agree.

"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

"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous


AnswerRe: Merging ArraysmemberStefan_Lang28 Nov '12 - 2:45 
1. determine the required size of the resulting container
2. Allocate a container of that size on the heap.
3. copy the elements to the new container.
 
If you have trouble following those steps, you better learn basic C/C++ by reading a good book or tutorial. A good one can be found at http://www.cplusplus.com/doc/tutorial/[^]
AnswerRe: Merging Arraysmembersajeesh.c30 Nov '12 - 18:47 
This is a simple program. I think in my opinion programming skill will develop through thinking, practice etc.
here your problem is simple. so try to implement self such a problem. i will give the logic.
1. allocate required array size for destination array.
2.copy the content from source array to destination.
I also agree with Richard and pallini Smile | :)
QuestionHow to use ribbon in MFC Activex controlmemberLamourou27 Nov '12 - 20:23 
Hi every body
I develop an ActiveX control (.ocx) but I have a problem with the use of the ribbon resource in this project. I want to add the ribbon but i don't know how to do it.
AnswerRe: How to use ribbon in MFC Activex controlmvpRichard MacCutchan27 Nov '12 - 23:44 
Start with these links[^].
One of these days I'm going to think of a really clever signature.

GeneralMessage RemovedmemberLamourou28 Nov '12 - 0:26 
Message Removed

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web01 | 2.6.130523.1 | Last Updated 23 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid