Game Development Community

DSprintf parameter question

by Ronald J Nelson · in Torque Game Engine · 03/21/2007 (6:08 pm) · 2 replies

In my command to script this for ShapeBase::onImpact I have added these two lines:

StringTableEntry collDebrisArg = Con::getArgBuffer(20);

dSprintf(collDebrisArg, 20, "%s", collDebris);

Upon compiling I get the error:

error C2664: 'dSprintf' : cannot convert parameter 1 from 'StringTableEntry' to 'char *'

Both collDebrisArg and collDebris are StringTableEntry, I assume the problem is with "%s".

What can I do to fix this?

#2
03/23/2007 (6:42 am)
The problem is with your first parameter in dSprintf.

dSprintf([b]char *buffer[/b], dsize_t bufferSize. const char *format, ...);

You would need to get a char* in that first parameter, not a StringTableEntry.

*EDIT*- This should also be noted:
typedef const char* StringTableEntry;

StringTableEntry is a const char*, so you don't have much work to do convert your parameters.