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

ATL / WTL / STL

 
Questionerror - cannot convert parameter 3 from 'char [1024]' to 'wchar_t *' Pin
Swap95-Aug-14 21:40
MemberSwap95-Aug-14 21:40 
AnswerRe: error - cannot convert parameter 3 from 'char [1024]' to 'wchar_t *' Pin
Richard MacCutchan5-Aug-14 22:34
mveRichard MacCutchan5-Aug-14 22:34 
AnswerRe: error - cannot convert parameter 3 from 'char [1024]' to 'wchar_t *' Pin
Subrat 470826612-Sep-14 15:15
MemberSubrat 470826612-Sep-14 15:15 
Questionhow to let menu auto show next item when mouse on the bottom arrow of menu Pin
fengforky9-Jul-14 22:53
Memberfengforky9-Jul-14 22:53 
AnswerRe: how to let menu auto show next item when mouse on the bottom arrow of menu Pin
Richard MacCutchan9-Jul-14 23:34
mveRichard MacCutchan9-Jul-14 23:34 
QuestionWCHAR, wstring, initializing and accessing them (RESOLVED) Pin
bkelly131-Jul-14 10:13
Memberbkelly131-Jul-14 10:13 
AnswerRe: WCHAR, wstring, initializing and accessing them Pin
Richard MacCutchan2-Jul-14 5:38
mveRichard MacCutchan2-Jul-14 5:38 
Generalnarrowing the focus a bit Pin
bkelly132-Jul-14 9:59
Memberbkelly132-Jul-14 9:59 
The array of character strings versus array of pointer was a good point. I will focus my question a bit tighter.
From C_AR2_Messages.h
WCHAR m_test_1_[COMMON_ARRAY_SIZE][MAX_PARAMETER_NAME_LENGTH];

COMMON_ARRAY_SIZE is const unsigned int = 18 and MAX_PARAMETER_NAME_LENGTH is same = 34, this is 18 WCHAR strings, each 34 characters long. I verified this by writing the following code in the constructor and stepping though with the debugger.

wcscpy_s( m_test_1[0], MAX_PARAMETER_NAME_LENGTH, L”[0] 1234” 
wcscpy_s( m_test_1[1], MAX_PARAMETER_NAME_LENGTH, L”[1] 1234” 
wcscpy_s( m_test_1[2], MAX_PARAMETER_NAME_LENGTH, L”[2] 1234” 
wstring test_5 = m_test_1[0];
wstring test_6 = m_test_1[1];
wstring test_7 = m_test_1[2];


Actually, the strings “1234” were continued out to about 25 characters to ensure the length was greater than 18.
The wstrings were used as a very convenient tool to capture the text from the strings and see what was there. I am confident that in C_AR2_Messages I have a good declaration for m_test_1 as an array of 18 character strings, each 34 characters in length.
The Goal
In C_Configuration_Manager the code reads a text file and initializes a bunch of parameters. It needs to read and right to those strings contained by m_test_1. My plan is to hand it the address of m_test_1. I am having difficulties with that. Here is what I have come up with.
In C_Configuration_Manager.h
WCHAR  *mp_common_parameter_names [COMMON_ARRAY_SIZE][MAX_PARAMETER_NAME_LENGTH];


That is to be a pointer to the array of strings. Then in C_Configuration_Manager dot CPP is the definition of the method to set the pointer:
Void C_Configuration_Manager::Set_common_names_Pointer(
WCHAR *new_pointer[ COMMON_ARRAY_SIZE][MAX_PARAMETER_NAME_LENGTH] )
{ mp_common_parameter_names = new_pointer; }

That did not work so well. The compiler says:
Quote:
1>e:\visual|studio\ar2_message_app_v11.1\ar2_message_app\c_configuration_manager.cpp(120)
: error C2440: ‘=’ : cannot convert from ‘WCHAR 8[][34] TO ‘wchar *[18][34]’
1> There are no conversions to array types, although there are conversions to references or pointers to arrays

Note that the first [ ] in the error message is empty. None of the declarations have an empty [ ].
With the thought of arrays of strings versus arrays of pointers I tried changing the declarations in C_Configuration_Manager to:
WCHAR  * (mp_common_parameter_names [COMMON_ARRAY_SIZE][MAX_PARAMETER_NAME_LENGTH] );


Note the added parens and the attempt to set order of operation and get a pointer to an array of strings. The error message was exactly the same.
So, …, how do I declare a pointer to an array of strings in the configuration_manager?
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 MacCutchan2-Jul-14 13:32
mveRichard MacCutchan2-Jul-14 13:32 
GeneralRe: narrowing the focus a bit Pin
bkelly132-Jul-14 17:00
Memberbkelly132-Jul-14 17:00 
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 
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 

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.