Forum

ftos

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

ftos

Postby r00k » Fri Jan 07, 2011 5:50 am

I can't remember but, can you use ftos twice in the same function?
Or wasnt ther some limitation on the use of ftos someting like the buffer didnt get cleared, hmm cant remember now.. Spike?
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby leileilol » Fri Jan 07, 2011 6:19 am

no you can't
One way around it is FRIK_FILE, IIRC
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Error » Fri Jan 07, 2011 6:43 am

I'm quite sure Darkplaces and FTE allow this.
User avatar
Error
InsideQC Staff
 
Posts: 865
Joined: Fri Nov 05, 2004 5:15 am
Location: VA, USA

Postby Spike » Fri Jan 07, 2011 11:56 am

you need MULTIPLE_TEMPSTRINGS or UNLIMITED_TEMPSTRINGS or so in the engine to guarentee that you the previous result is not changed by the second call.
Cos it returns from a static internal buffer.

or you can use frik_file's strzone function to dupe it before calling it the second time, but don't forget to unzone too.

in a regular engine:
centerprint2(self, ftos(5), ftos(8))
will print:
88
or so.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby r00k » Sat Jan 08, 2011 6:31 am

Ok thanks, Ill make sure it dispatches the string before the second ftos.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest