Click here to Skip to main content
15,887,854 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: narrowing the focus a bit Pin
bkelly134-Jul-14 1:13
bkelly134-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
bkelly134-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
bkelly134-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
bkelly134-Jul-14 8:20 
Here is my solution that demonstrates passing the pointer and gaining access to the array of strings:
C#
#include "stdafx.h"

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

struct st2_names
{
    wchar_t names[ COMMON_ARRAY_SIZE ] [ MAX_NAME_SIZE ];
};

void Set_Pointer_2( st2_names *new_pointer );

int _tmain(int argc, _TCHAR* argv[])
{
    st2_names names_2;

    wcscpy_s( names_2.names[0]  , MAX_NAME_SIZE, L"PITCH" );
    wcscpy_s( names_2.names[1]  , MAX_NAME_SIZE, L"ROLL" );
    wcscpy_s( names_2.names[2]  , MAX_NAME_SIZE, L"YAW" );
    wcscpy_s( names_2.names[3]  , MAX_NAME_SIZE, L"VELOCITY" );

    Set_Pointer_2( &names_2 );
    return 0;
}

void Set_Pointer_2( st2_names *new_pointer )
{
    st2_names *mp_names_2;
    mp_names_2 = new_pointer;

    wchar_t t1[MAX_NAME_SIZE];
    wchar_t t2[MAX_NAME_SIZE];
    wchar_t t3[MAX_NAME_SIZE];
    wchar_t t4[MAX_NAME_SIZE];

    wcscpy_s( t1, MAX_NAME_SIZE, mp_names_2->names[0] );
    wcscpy_s( t2, MAX_NAME_SIZE, mp_names_2->names[1] );
    wcscpy_s( t3, MAX_NAME_SIZE, mp_names_2->names[2] );
    wcscpy_s( t4, MAX_NAME_SIZE, mp_names_2->names[3] );
}



It is a but ugly, but does work. EDIT, I did simplify.

It does seem to me that you are saying: No, there is no way to create a simple multi-dimension array such as:
wchar_t names[ x ] [ y ];

and pass a pointer to a procedure, then use that pointer to access all the elements of the array.
Thank you for your time
If you work with telemetry, please check this bulletin board: www.irigbb.com



modified 4-Jul-14 15:30pm.

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
bkelly135-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
bkelly137-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
bkelly1330-Jun-14 5:55 
AnswerRe: friend declaration causes undeclared identifier Pin
Subrat 470826612-Sep-14 15:20
Subrat 470826612-Sep-14 15:20 
Questiondestructor not being called (Resolved) Pin
bkelly1326-Jun-14 16:17
bkelly1326-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
bkelly1327-Jun-14 13:06 
Questionarray of static text controls Pin
bkelly1322-Jun-14 9:35
bkelly1322-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
bkelly1313-Jun-14 4:27 
AnswerRe: need help selecting a string type Pin
Richard MacCutchan13-Jun-14 7:13
mveRichard MacCutchan13-Jun-14 7:13 
GeneralRe: need help selecting a string type Pin
bkelly1313-Jun-14 7:39
bkelly1313-Jun-14 7:39 
GeneralRe: need help selecting a string type Pin
Richard MacCutchan13-Jun-14 21:31
mveRichard MacCutchan13-Jun-14 21:31 
GeneralRe: need help selecting a string type Pin
bkelly1314-Jun-14 9:47
bkelly1314-Jun-14 9:47 

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.