TGE 1.5.1 winStrings bug?
by Frank Korf · in Torque Game Engine · 04/13/2007 (8:48 am) · 3 replies
I updated from TGE 1.5 to TGE 1.5.1
I am compiling with Visual C++ 2005 Express Edition (ver 8.0.50727.762)
This code:
used to return
After updating to 1.5.1 it now returns
In fact, all strings in the array only seem to save the first four characters.
I reverted the file platformWin32/winStrings.cc back to the 1.5 code and it works again.
The only changes I see have to do with Codewarrior.
I'm not complaining. I did get it to work. I just wanted to help anybody else who finds the same issue.
I am compiling with Visual C++ 2005 Express Edition (ver 8.0.50727.762)
This code:
char **mStringArray; mStringArray = new char* [10]; mStringArray[0] = new char[20]; dSprintf(mStringArray[0], sizeof(mStringArray[0]), "Hello!" ); Con::errorf(mStringArray[0]);
used to return
Hello!
After updating to 1.5.1 it now returns
Hell
In fact, all strings in the array only seem to save the first four characters.
I reverted the file platformWin32/winStrings.cc back to the 1.5 code and it works again.
The only changes I see have to do with Codewarrior.
I'm not complaining. I did get it to work. I just wanted to help anybody else who finds the same issue.
#2
So is this the correct solution?
04/13/2007 (11:09 am)
Wow. Oops. BKC error.So is this the correct solution?
char **mStringArray; mStringArray = new char* [10]; mStringArray[0] = new char[20]; dSprintf(mStringArray[0], sizeof(char[20]), "Hello!" ); Con::errorf(mStringArray[0]);
#3
you could just do this tho:
dSprintf(mStringArray[0], 20, "Hello!" );
04/13/2007 (1:17 pm)
That should work.you could just do this tho:
dSprintf(mStringArray[0], 20, "Hello!" );
Torque Owner Badguy
vergil.chemistry.gatech.edu/resources/programming/c-tutorial/dynamic.html
this should never have worked, unless your strings have been under 4 bytes long.
sizeof a pointer in 32 bit will be 4 bytes.