Home » Extra libraries, Code snippets, applications etc. » U++ users applications in progress and useful code snippets, including reference examples! » Invalid conversion
Re: Invalid conversion [message #7584 is a reply to message #7583] |
Sun, 07 January 2007 18:36 |
|
mirek
Messages: 13980 Registered: November 2005
|
Ultimate Member |
|
|
String text = ....
const char *s = text;
(warning: s valid only till next mutating operation on text).
If you really need char[], you can also do this:
char h[...];
strcpy(h, text);
Anyway, beware, there is a danger of buffer overrun (if text.GetLength() is greater than sizeof(h) - 1.)
Alternative, without buffer overrun danger:
Buffer<char> h(text.GetLength() + 1);
memcpy(h, text, text.GetLength() + 1);
[Updated on: Sun, 07 January 2007 18:37] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue May 28 12:24:15 CEST 2024
Total time taken to generate the page: 0.00721 seconds
|