About Store Forum Documentation Contact



Post Reply 
Convert string to char*
Author Message
Dynad Offline
Member

Post: #1
Convert string to char*
Hey,

I want to convert the engine Str to char* but the compilers gives me great errors which i don't really understand. probably i don't know how to use it.

Tried operator CChar16 * and operator ()

The following code:
PHP Code:
rakpeer1->Send(message.operator CChar16 *, strlen(message.operator ())+1HIGH_PRIORITYRELIABLE_ORDERED0UNASSIGNED_SYSTEM_ADDRESStrue); 

Gives me this error:
PHP Code:
error C3867'EE::Str16::operator const CChar16': function call missing argument list; use '&EE::Str16::operator const CChar16' to create a pointer to member 


Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 02-04-2010 09:10 PM by Dynad.)
02-04-2010 09:09 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Masterxilo Offline
Member

Post: #2
RE: Convert string to char*
What are the arguments for that Send method?

System: Windows 7 Ultimate 64 bit, Q6600 2.4 GHZ, 4GB RAM, nVidia GeForce 260 GTX 896 MB DDR3

Visit my site: hurricane-eye.webs.com
And read my blog: hurricane-eyeent.blogspot.com
02-04-2010 09:25 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Kevin Offline
Member

Post: #3
RE: Convert string to char*
Code from my project:

Code:
wchar_t* f = (wchar_t*)file;

size_t origsize = wcslen(f) + 1;
const size_t newsize = 100;
size_t convertedChars = 0;
char nstring[newsize];
wcstombs_s(&convertedChars, nstring, origsize, f, _TRUNCATE);

converts CChar* [file] to char* [nstring].

regards,
Kevin
02-04-2010 09:25 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: Convert string to char*
Str8 str=Str("text");
const char* s=str;

in shortcut:

->Send((Str8)message,
02-04-2010 09:35 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #5
RE: Convert string to char*
Ok but what kind of type is "file"??

U cant just cast from CChar16 * to wchar_t*.... or am i missing something?

Nvm, Esenthel ty that is working smile

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 02-04-2010 09:38 PM by Dynad.)
02-04-2010 09:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Masterxilo Offline
Member

Post: #6
RE: Convert string to char*
For Esenthel's example: My compiler says
"EE:Str8 can't be converted to char*"

System: Windows 7 Ultimate 64 bit, Q6600 2.4 GHZ, 4GB RAM, nVidia GeForce 260 GTX 896 MB DDR3

Visit my site: hurricane-eye.webs.com
And read my blog: hurricane-eyeent.blogspot.com
(This post was last modified: 02-04-2010 09:38 PM by Masterxilo.)
02-04-2010 09:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #7
RE: Convert string to char*
yes, forgot to add 'const' (fixed it)
02-04-2010 09:39 PM
Find all posts by this user Quote this message in a reply
Chris Offline
Member

Post: #8
RE: Convert string to char*
Perhaps some of us could get together and make a RakNet tutorial with login and chat for Esenthel Engine with client and server projects?

Perhaps similar to Player demo (which used ogre): http://princeofcode.com/blog/?p=249
(warning uses a slightly older version of raknet)

Would that be useful? I remember some other people said they were using RakNet, but can't exactly remember who.
02-04-2010 09:50 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #9
RE: Convert string to char*
I like the idea
02-04-2010 10:14 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #10
RE: Convert string to char*
ok but when i try to convert it back to a Str i get strange Chinese text. probably the cast is not correct.

I tried Str test = (CChar) (packet->data+1);

The data in the packet->data is correct debugged it smile

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 02-05-2010 12:43 AM by Dynad.)
02-05-2010 12:42 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #11
RE: Convert string to char*
try CChar8* (or just char*)
02-05-2010 12:47 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #12
RE: Convert string to char*
(char*) works fine pfft

Ive a tiny question about the GUI, when i add a message i need to open the chat bar first with a button -> thats set on the letter T. But when i push on T it adds the letter T right away in the chat bar.

TextLine *chatbar;
I tried to use chatbar->clear(true); before chatbar->visibleActivate(true); but this is not working.

There is always evil somewhere, you just have to look for it properly.
02-05-2010 07:38 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #13
RE: Convert string to char*
when you detect 't' char, you can try immediately calling Kb.eat(KB_T) for example, this should eat the input
02-05-2010 03:49 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #14
RE: Convert string to char*
uhm ok, but is the eat an engine function or...?

There is always evil somewhere, you just have to look for it properly.
02-05-2010 05:56 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #15
RE: Convert string to char*
oh, it is currently hidden
ill make it available for the next release
02-06-2010 12:08 AM
Find all posts by this user Quote this message in a reply
Post Reply