472,958 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 software developers and data experts.

syntax problem calling trimstart

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 .
Dec 2 '05 #1
2 2111
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 .

Dec 2 '05 #2
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 .


Dec 5 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
37
by: Bengt Richter | last post by:
ISTM that @limited_expression_producing_function @another def func(): pass is syntactic sugar for creating a hidden list of functions. (Using '|' in place of '@' doesn't change the picture...
7
by: Steven Bethard | last post by:
So here's the state of the decorator debate as I see it: *** Location GvR pretty strongly wants decorators before the function: ...
19
by: Nicolas Fleury | last post by:
Hi everyone, I would to know what do you think of this PEP. Any comment welcomed (even about English mistakes). PEP: XXX Title: Specialization Syntax Version: $Revision: 1.10 $...
7
by: GrandpaB | last post by:
I am comparing two strings for sorting. In some cases the string may be enclosed in quotes. Since the quote character is less than the A character, all the strings enclosed in quotes will finish...
21
by: Dmitry Anikin | last post by:
I mean, it's very convenient when default parameters can be in any position, like def a_func(x = 2, y = 1, z): ... (that defaults must go last is really a C++ quirk which is needed for overload...
2
by: sjoshi | last post by:
Is List.ConvertAll the only way to apply TrimStart to elements of a List<stringor is there a better way ? Currently I'm doing this... List<stringlst = new List<string>(); lst.AddRange(new...
9
by: parag_paul | last post by:
Hi all I am seeing the following code in one place standalone line in some function , { (void*) new (h) Class_Name(xip, virobj, type, true); } Does it make h an object of the Class_Name...
6
Soniad
by: Soniad | last post by:
Hello, I am excecuting a stored procedure in my ASP page , it has one out parameter (@confirm) . after executing the procedure i want to retreive this out parameter and assign it to variable...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.