ATL / WTL / STL
|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.
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;
wcscpy_s( one, MAX_NAME_SIZE, local_pointer );
wcscpy_s( two, MAX_NAME_SIZE, new_pointer );
int _tmain(int argc, _TCHAR* argv)
wchar_t names[ COMMON_ARRAY_SIZE ][ MAX_NAME_SIZE ];
wcscpy_s( names[ 0 ], MAX_NAME_SIZE, L" 123" );
wcscpy_s( names[ 1 ], MAX_NAME_SIZE, L" 123" );
wcscpy_s( names[ 2 ], MAX_NAME_SIZE, L" 123" );
wcscpy_s( names[ 3 ], MAX_NAME_SIZE, L" 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 ' to 'wchar_t '
I note that there is NOT any variable/array declared as . Trying to convert from  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
General News Suggestion Question Bug Answer Joke Praise Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.