Re: String Manipulations



Thanks much Igor,

I would tend to agree with you based on the fact that the information you've
provided in just a few short replies being far more enlightening than the
sample code I acquired from this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_cstring.3a3a.operator_lpctstr.asp

I am good on this now and Hope to chat again soon!

Mark

"Igor Tandetnik" <itandetnik@xxxxxxxx> wrote in message
news:OFy7S857FHA.3660@xxxxxxxxxxxxxxxxxxxxxxx
> Mark <mark_ivey4@xxxxxxxxx> wrote:
>> I get it. But I didn't explicitly designate my program to run under
>> Unicode although after taking your advice it worked as I originally
>> expected. I am using VC++ 2005, where would the program be designated
>> to run under Unicode?
>
> I don't have VC2005 handy to check. In VC2003, that would be Project
> Properties | General | Character Set = Use Unicode. I expect VC2005 to be
> the same or very close.
>
>> I also noted that there is another procedure I acquired from MS
>> within the same scope of the CString example that wont compile either.
>>
>> sprintf(sz, "I think that %s!\n", (LPCTSTR) strSports);
>>
>> The compiler doesn't like this and produces an error:
>>
>> error C2664: 'sprintf' : cannot convert parameter 1 from 'TCHAR
>> [1024]' to 'char *'
>
> Make it
>
> _stprintf(sz, _T("I think that %s!\n"), (LPCTSTR) strSports);
>
> That should compile in both Unicode and Ansi builds. _stprintf is a macro
> expanding to swprintf or sprintf correspondingly.
>
>> Perhaps my project environment needs to be adjusted a bit? Running
>> sample code shouldn't be this cumbersome.
>
> Where are you getting this sample code? It does not seem to be
> particularly well designed, to put it mildly.
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>
>


.



Relevant Pages

  • Re: String Manipulations
    ... > Unicode although after taking your advice it worked as I originally ... That should compile in both Unicode and Ansi builds. ... > Perhaps my project environment needs to be adjusted a bit? ... > sample code shouldn't be this cumbersome. ...
    (microsoft.public.vc.language)
  • Re: How to display German Umlauts correctly on Mac and Unix
    ... > larger due to translation tables). ... If you have to custom compile build tools to get a feature, ... And with the Unicode translation steps. ... "are written using the Unicode character set". ...
    (comp.lang.java.gui)
  • Re: Multicast Socket for Win CE 4.2 / Pocket PC 2003
    ... API and multicast works, in general, on a variety of devices that I've built ... I can't speak directly for Pocket PC, ... The Unicode thing has *nothing* to do with incompatibility and Microsoft ... it does not even compile. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Re[2]: Pre-information on Unicode in Delphi 2008
    ... and will not compile if the new VCL is utterly Unicode. ... So "all existing" applications would break and simply making application ... This is NOT what string encoding RTTI would be for, ...
    (borland.public.delphi.non-technical)
  • Re: How to port pocket pc 2002 application to windows xp??
    ... edition if the program doesn't use the Microsoft Foundation Classes ... This will let you compile ... string problems. ... make sure UNICODE and _UNICODE are _both_ defined ...
    (microsoft.public.pocketpc.developer)