Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » FDS crash when using std:: string
FDS crash when using std:: string [message #250284] Sat, 17 March 2007 20:58 Go to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
Well i wanted to convert the message from the chat hook from const wchar_t to string so i used
std::string Msg3 = WideCharToChar(Msg);

but everytime I run my server and type something in chat, Msg3 is = "/"

Any help?
Re: FDS crash when using std:: string [message #250287 is a reply to message #250284] Sat, 17 March 2007 21:41 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

What do you need a std::string for?


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: FDS crash when using std:: string [message #250319 is a reply to message #250284] Sun, 18 March 2007 05:49 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
I wanted to convert the chat into a string where it would be eaiser to manipulate the chat
Re: FDS crash when using std:: string [message #250325 is a reply to message #250284] Sun, 18 March 2007 06:22 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
std::string mystring(mychar);
Re: FDS crash when using std:: string [message #250331 is a reply to message #250284] Sun, 18 March 2007 06:53 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
i tried it but it still it only returns "/"
Re: FDS crash when using std:: string [message #250339 is a reply to message #250284] Sun, 18 March 2007 07:29 Go to previous messageGo to next message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma: 0
General (3 Stars)
works fine for me :/

try

char buf[256];
size_t count = wcstombs(buf, Message, 256);
buf[count] = '\0';

string mystring(buf);


[Updated on: Sun, 18 March 2007 07:30]

Report message to a moderator

Re: FDS crash when using std:: string [message #250397 is a reply to message #250284] Sun, 18 March 2007 14:10 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
thnx for the help, turns out i forgot 2 add .c_str on sprintf for my output and i misnamed a varible in find which would lead to the crash Embarassed Huh
still appreciate the help
Re: FDS crash when using std:: string [message #250461 is a reply to message #250284] Mon, 19 March 2007 01:16 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
Why not just use StringClass?

[Updated on: Mon, 19 March 2007 01:16]

Report message to a moderator

Re: FDS crash when using std:: string [message #250632 is a reply to message #250284] Mon, 19 March 2007 19:11 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
... i am Huh
Re: FDS crash when using std:: string [message #250666 is a reply to message #250284] Tue, 20 March 2007 00:17 Go to previous messageGo to next message
saberhawk
Messages: 1068
Registered: January 2006
Location: ::1
Karma: 0
General (1 Star)
StringClass or WideStringClass as found in scripts.dll code?
Re: FDS crash when using std:: string [message #250736 is a reply to message #250284] Tue, 20 March 2007 12:06 Go to previous messageGo to next message
a100 is currently offline  a100
Messages: 45
Registered: March 2007
Karma: 0
Recruit
stringclass
Re: FDS crash when using std:: string [message #250895 is a reply to message #250284] Wed, 21 March 2007 05:39 Go to previous message
Sir Kane
Messages: 1701
Registered: March 2003
Location: Angerville
Karma: 0
General (1 Star)
std:: is for noobies.

Proud N9500 and proud N6270 user. Creator of the IEE libraries (original bhs.dll) and the RB series software.
http://n00bstories.com/image.fetch.php?id=1189992501http://www.n00bstories.com/image.fetch.php?id=1257492907
Previous Topic: Remaking carnage club!
Next Topic: C&C_StuntMania Beta 1
Goto Forum:
  


Current Time: Thu Nov 14 06:38:59 MST 2024

Total time taken to generate the page: 0.00876 seconds