Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » How to convert String to char ?
Re: How to convert String to char ? [message #12511 is a reply to message #12508] Tue, 06 November 2007 21:15 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14255
Registered: November 2005
Ultimate Member
LiniX wrote on Tue, 06 November 2007 13:08

Thank you .

But library function in put is only char*,

How to change const char* to char* ? or can't ?

Thank you
Watchara Kangkun


You cannot convert String to char *.

The reason is that String interface is created so that efficient reference counted implementation is possible. That excludes this kind of conversion.

If you need to write to String content, you can use StringBuffer though.

String x = "Fun";
StringBuffer sb = x;
char *s = ~sb;
s[1] = 'a';
x = sb;


Note that transfers between StringBuffer and String are very fast, as long as the reference count (if any) is 1.

(Note2: Current String implementation uses reference counting only for long Strings).

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: XML , DOM - Modify the tree
Next Topic: Control with window handle
Goto Forum:
  


Current Time: Mon Apr 28 06:03:53 CEST 2025

Total time taken to generate the page: 0.03967 seconds