Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wcscpy converted from strcpy

Status
Not open for further replies.

Tremorblue

Programmer
Apr 30, 2004
56
0
0
GB
Ansi string to widestring conversion..

Why does this work using ansistring ?

char s[20],t[20];
AnsiString aW;
strcpy(s,t); // Works
strcpy(s,aW.c_str()); Works.

And this does not work using widestring ?

wchar_t s[20],t[20];
WideString aW;
wcscpy(s,t); // This works
wcscpy(s,aW.c_bstr()); // This crashes.


 
What version of Builder are you using?



James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Also FileExists routine does not seem to support wide characters. Is there support for this in later versions.

 
Starting with the later Builders (2007?) unicode strings had full support. Starting with Builder 2010, unicode strings were the default strings. Anything that AnsiString could do, UnicodeStrings can do. Routines and components like FileExists now default to unicode strings.

I suspect a bug in BCB 6 with wide strings but I'm trying to find out.



James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Oddly enough, I was just about to suggest that.


James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top