Click here to Skip to main content
14,664,021 members
Home » Discussions » ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan3-Jul-14 4:17
mveRichard MacCutchan3-Jul-14 4:17 
GeneralRe: narrowing the focus a bit Pin
bkelly133-Jul-14 17:24
Memberbkelly133-Jul-14 17:24 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 0:36
mveRichard MacCutchan4-Jul-14 0:36 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 1:13
Memberbkelly134-Jul-14 1:13 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 1:45
mveRichard MacCutchan4-Jul-14 1:45 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 3:08
mveRichard MacCutchan4-Jul-14 3:08 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 5:02
Memberbkelly134-Jul-14 5:02 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 5:40
mveRichard MacCutchan4-Jul-14 5:40 
bkelly13 wrote:
I get back to where I started.
Hence the final comment in my previous answer.

The issue is that you are trying to copy data from a multi-dimensional array using a single dimension pointer; and given the structure of your original array you have no other choice. If you used the memcpy option which I suggested and just copy the entire array to a new array inside the class then you have your data correctly saved.

If you want to do it the hard way then you can do this:
// allocate an array of items
wchar_t savedItems[COMMON_ARRAY_SIZE][MAX_NAME_SIZE];
// create a local pointer to the original array that points to the first item
wchar_t* localPointer;
localPointer = new_pointer;
for (int i = 0; i < COMMON_ARRAY_SIZE; ++i)
{
    wcscpy_s(savedItems[i], MAX_NAME_SIZE, localPointer);
    localPointer += MAX_NAME_SIZE; // point to the next item which is MAX_NAME_SIZE characters on
}

If you want to do it with individually named items then just copy them in order, remembering to add MAX_NAME_SIZE to localPointer after each copy.
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 7:07
Memberbkelly134-Jul-14 7:07 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 7:21
mveRichard MacCutchan4-Jul-14 7:21 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 8:20
Memberbkelly134-Jul-14 8:20 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 20:10
mveRichard MacCutchan4-Jul-14 20:10 
Generalreasons Pin
bkelly135-Jul-14 7:22
Memberbkelly135-Jul-14 7:22 
GeneralRe: reasons Pin
Richard MacCutchan6-Jul-14 4:44
mveRichard MacCutchan6-Jul-14 4:44 
GeneralRe: reasons Pin
bkelly137-Jul-14 14:03
Memberbkelly137-Jul-14 14:03 
GeneralRe: reasons Pin
Richard MacCutchan7-Jul-14 22:04
mveRichard MacCutchan7-Jul-14 22:04 
Questionfriend declaration causes undeclared identifier Pin
bkelly1330-Jun-14 5:55
Memberbkelly1330-Jun-14 5:55 
AnswerRe: friend declaration causes undeclared identifier Pin
Subrat 470826612-Sep-14 15:20
MemberSubrat 470826612-Sep-14 15:20 
Questiondestructor not being called (Resolved) Pin
bkelly1326-Jun-14 16:17
Memberbkelly1326-Jun-14 16:17 
AnswerRe: destructor not being called Pin
Orjan Westin26-Jun-14 22:26
professionalOrjan Westin26-Jun-14 22:26 
GeneralRe: destructor not being called Pin
bkelly1327-Jun-14 13:06
Memberbkelly1327-Jun-14 13:06 
Questionarray of static text controls Pin
bkelly1322-Jun-14 9:35
Memberbkelly1322-Jun-14 9:35 
AnswerRe: array of static text controls Pin
Albert Holguin26-Jun-14 10:48
professionalAlbert Holguin26-Jun-14 10:48 
Questionneed help selecting a string type Pin
bkelly1313-Jun-14 4:27
Memberbkelly1313-Jun-14 4:27 
AnswerRe: need help selecting a string type Pin
Richard MacCutchan13-Jun-14 7:13
mveRichard MacCutchan13-Jun-14 7:13 

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.