|
There is a boatload of CRT string manipulation functions. You can be kind enough not to add a query here for every single function that is referred to in your code.
Just get to the documentation page[^] and click on the function that you're using. Then, choose the generic text mapping routine version (tchar.h routine) of that function. As an example, choose _tcsdec instead of _strdec . You might want to read about Using Generic Text-Mappings[^].
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Code Segment is
token=strtok(userid,_T(";"));
What about this error?
'strtok' : cannot convert parameter 2 from 'const wchar_t [2]' to 'const char *'
|
|
|
|
|
Is it really that difficult? Read my previous reply to you again. Go to the documentation page and click on strtok and choose the generic text mapping routine equivalent instead.
You need to read on Unicode, Generic Text mappings, Internationalization, and string manipulation. You really need to.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I have changed that.
Now the new error is
'wcstok' : cannot convert parameter 1 from 'char [1000]' to 'wchar_t *'
what should I do now?
|
|
|
|
|
Purish Dwivedi wrote: what should I do now?
You are looking for someone to give you an 'instant fix' (not to mention you post a query for every error of the same type) without even understanding your problem properly, which is essentially not going to help you in the longer run. I am wanting you to understand the basics so that you will be able to solve the problem yourself.
Therefore, do what Cédric asked you to do[^]
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I'm not getting that what to do?
Plz help me.
thanks.
|
|
|
|
|
Purish Dwivedi wrote: I'm not getting that what to do?
Look, people here are willing to help but if you don't want to put any effort yourself, then you can forget about it. The article I linked to you contains a lot of information about unicode and non-unicode builds. Once you have read the article, you will understand that to support both unicode and non-unicode builds, you will need to use TCHAR (and not char) and all the unicode-independant string manipulation routines (instead of strcpy, strlen, strtok, ...). For ALL of those functions, if you look in the MSDN documentation, you have a table that compares the different versions. You always have to use the "TCHAR.h routine" version.
|
|
|
|
|
Cedric Moonen wrote: unicode-independant string manipulation routines
Would that be rather character set independent string manipulation routines? OK, I'm just being a nitpick.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: Would that be rather character set independent string manipulation routines?
To be honnest, I didn't know the exact terminology. Now I know
|
|
|
|
|
As someone else mentioned, it looks like you have some mixed UNICODE and ANSI problems.
Ti make the code portable, make sure you have included "TCHAR.H" and use
_tcslen instead of strlen.
That should fix the problem.
Tony
|
|
|
|
|
try _tcscpy_s function instead strcpy function
take a look in strpy definition strcpy work only ASCII , but TCHAR is char if Unicode is not defined or TCHAR is wchar_t if Unicode is defined
|
|
|
|
|
Code Segment is
token=strtok(userid,_T(";"));
What about this error?
'strtok' : cannot convert parameter 2 from 'const wchar_t [2]' to 'const char *'
|
|
|
|
|
It looks like you're doing a UNICODE build, but, neverthless, userid is declared as char * (or char userid[] ) insetad of TCHAR * and, moreover, you're not using the generic text equivalent of strtok (i.e. _tcstok ).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
This is my code segment.
CString timestamp;
int year = _atoi64((LPCTSTR)timestamp.Left(4));
I am getting an error like
'_atoi64' : cannot convert parameter 1 from 'LPCTSTR' to 'const char *'
How can I remove it?
Thanks.
|
|
|
|
|
try _ttoi(static_cast<LPCTSTR>(timestamp.Left(4)));
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Thanks Anshuman, It worked for me.
|
|
|
|
|
BTW, the static_cast<lpctstr>() is useless and can be omitted
|
|
|
|
|
_AnsHUMAN_ wrote: try _ttoi(static_cast<lpctstr>(timestamp.Left(4)));
Just adding to toxcct's reply, CString has the LPCTSTR operator!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Hi all,
I m creating a dialog base application and running it in hide mode.the GUI of application not visible.
Application wants a permission to run as admin.
i want this application when i execute the application on any PC than its running over it till the PC opened,when the system restart than its automatically start with system.I think it is done by Window service.
but i have no idea of Window service.
I m also add this exe vaule in registry for startup its works fine but in case of UAC enabled in VISTA the strtup program is blocked because its not have permission to run as admin.
so please tell me how can i run it on startup with admin permission.
and tell me how can i run it over PC every time.
please suggest me right way and method to do this.
if possible please explain me with example.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
if you don't want to show gui part to user and run your program in background services are best choices, there are numerous application available on net which can your program as service (without actually modifying your source code). search " running executable as service" on net
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
please help me....
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
Let me get it right... You have an executable, you don't want to show an UI, it must run at startup, and with admin rights and should bypass UAC.
May I ask you what exactly does your app do?!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Actully i working on Client_server type application.
so for sending continue information to server client exe must exist on client PC.
my exe running on hide mode and sending information to server for connection.
thats why i doing this.
so please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: my exe running on hide mode and sending information to server...
What kind of information? Does the user have control over this?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
My application is basically a Client-Server application,Client side exe send information about the connection of Client to server.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|