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

ATL / WTL / STL

 
AnswerRe: how to let menu auto show next item when mouse on the bottom arrow of menu Pin
Richard MacCutchan10-Jul-14 0:34
mveRichard MacCutchan10-Jul-14 0:34 
QuestionWCHAR, wstring, initializing and accessing them (RESOLVED) Pin
bkelly131-Jul-14 11:13
Memberbkelly131-Jul-14 11:13 
AnswerRe: WCHAR, wstring, initializing and accessing them Pin
Richard MacCutchan2-Jul-14 6:38
mveRichard MacCutchan2-Jul-14 6:38 
Generalnarrowing the focus a bit Pin
bkelly132-Jul-14 10:59
Memberbkelly132-Jul-14 10:59 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan2-Jul-14 14:32
mveRichard MacCutchan2-Jul-14 14:32 
GeneralRe: narrowing the focus a bit Pin
bkelly132-Jul-14 18:00
Memberbkelly132-Jul-14 18:00 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan3-Jul-14 5:17
mveRichard MacCutchan3-Jul-14 5:17 
GeneralRe: narrowing the focus a bit Pin
bkelly133-Jul-14 18:24
Memberbkelly133-Jul-14 18:24 
The configuration class is to make changes to several data items needed by the AR2_Messages class. I don't think memcpy will provide the results needed. If I can do memcpy, then when can I not just set a pointer.
I have been nibbling around the edges but cannot quite get a full chomp on this cookie.
I have created a Console App project just to test the concept. While doing that I discovered that a Console App gets indigestion on WCHAR so I changed to wchar_t. Here is my best effort so far.

#include "stdafx.h"

const unsigned int COMMON_ARRAY_SIZE = 10;
const unsigned int MAX_NAME_SIZE = 34;

void Set_Pointer( wchar_t new_pointer[ COMMON_ARRAY_SIZE ][ MAX_NAME_SIZE ])
{
    wchar_t local_pointer[ COMMON_ARRAY_SIZE ][ MAX_NAME_SIZE ];
    wchar_t one[ MAX_NAME_SIZE ];
    wchar_t two[ MAX_NAME_SIZE ];

    local_pointer = new_pointer;  // line 12 will not compile

    wcscpy_s( one, MAX_NAME_SIZE, local_pointer[0]  ); // will work
    wcscpy_s( two, MAX_NAME_SIZE, new_pointer[1]  );   // line 15
};

int _tmain(int argc, _TCHAR* argv[])
{
    wchar_t names[ COMMON_ARRAY_SIZE ][ MAX_NAME_SIZE ];

    wcscpy_s( names[ 0 ], MAX_NAME_SIZE, L"[0] 123" );
    wcscpy_s( names[ 1 ], MAX_NAME_SIZE, L"[1] 123" );
    wcscpy_s( names[ 2 ], MAX_NAME_SIZE, L"[2] 123" );
    wcscpy_s( names[ 3 ], MAX_NAME_SIZE, L"[3] 123" );

    Set_Pointer( names );
    return 0;  }


The line marked as line 12 will not compile producing the following error:
Quote:
Error 1 error C2440: '=' : cannot convert from 'wchar_t [][34]' to 'wchar_t [10][34]'



I note that there is NOT any variable/array declared as [][34]. Trying to convert from [][34] appears to be a misleading error message.

Not the line commented as line 15. When line 12 is commented out the code will copy to the local string using the argument pointer directly. So why does is refuse to set the local pointer, declared with exactly the same syntax? More important, how can I change to code to allow that pointer set?
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com


GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 1:36
mveRichard MacCutchan4-Jul-14 1:36 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 2:13
Memberbkelly134-Jul-14 2:13 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 2:45
mveRichard MacCutchan4-Jul-14 2:45 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 4:08
mveRichard MacCutchan4-Jul-14 4:08 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 6:02
Memberbkelly134-Jul-14 6:02 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 6:40
mveRichard MacCutchan4-Jul-14 6:40 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 8:07
Memberbkelly134-Jul-14 8:07 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 8:21
mveRichard MacCutchan4-Jul-14 8:21 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 9:20
Memberbkelly134-Jul-14 9:20 
GeneralRe: narrowing the focus a bit Pin
Richard MacCutchan4-Jul-14 21:10
mveRichard MacCutchan4-Jul-14 21:10 
Generalreasons Pin
bkelly135-Jul-14 8:22
Memberbkelly135-Jul-14 8:22 
GeneralRe: reasons Pin
Richard MacCutchan6-Jul-14 5:44
mveRichard MacCutchan6-Jul-14 5:44 
GeneralRe: reasons Pin
bkelly137-Jul-14 15:03
Memberbkelly137-Jul-14 15:03 
GeneralRe: reasons Pin
Richard MacCutchan7-Jul-14 23:04
mveRichard MacCutchan7-Jul-14 23:04 
Questionfriend declaration causes undeclared identifier Pin
bkelly1330-Jun-14 6:55
Memberbkelly1330-Jun-14 6:55 
AnswerRe: friend declaration causes undeclared identifier Pin
Subrat 470826612-Sep-14 16:20
MemberSubrat 470826612-Sep-14 16:20 
Questiondestructor not being called (Resolved) Pin
bkelly1326-Jun-14 17:17
Memberbkelly1326-Jun-14 17:17 

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.