I had tried initializing as an array but got various other compiler issues,
so I presume that I am not declaring it correct for a managed object
__wchar_t MyChar[] = {'0'};
c:\T02010_NET_ora9\cgi-bin\programs\TimeReader\TimeReaderWinService.cpp(3 27):
error C2664: 'System::String::TrimStart' : cannot convert parameter 1 from
'__wchar_t [1]' to '__wchar_t __gc[]'
char MyChar[] = {'0'};
c:\T02010_NET_ora9\cgi-bin\programs\TimeReader\TimeReaderWinService.cpp(3 27):
error C2664: 'System::String::TrimStart' : cannot convert parameter 1 from
'char [1]' to '__wchar_t __gc[]'
__wchar_t MyChar[] = {"0"};
c:\T02010_NET_ora9\cgi-bin\programs\TimeReader\TimeReaderWinService.cpp(2 85):
error C2440: 'initializing' : cannot convert from 'const char [2]' to
'__wchar_t'
c:\T02010_NET_ora9\cgi-bin\programs\TimeReader\TimeReaderWinService.cpp(3 27):
error C2664: 'System::String::TrimStart' : cannot convert parameter 1 from
'__wchar_t [1]' to '__wchar_t __gc[]'
"Peter Oliphant" wrote:
The problem is that TrimStart can trim more than one character at the same
time, so it expects an array of these characters, not just one. So create an
array of one element, make '0' that one element, and pass this array instead
of passing just '0'...
[==P==]
"brian_harris" <br*********@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...I am tring to use trimstart to remove leading zeros, but all things I try
give a compiler error on converting data. I am programing in C++ .net
vs2003.
This is one of my earlier attempts to call function
empcode = empcode->TrimStart ('0');
This is result:
c:\T02010_NET_ora9\cgi-bin\programs\TimeReader\TimeReaderWinService.cpp(3 22):
error C2664: 'System::String::TrimStart' : cannot convert parameter 1 from
'char' to '__wchar_t __gc[]'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
I have tried several ways to declare 0 but have not been able to get it in
right format I did try assigning 0 to a __wchar_t .