Contents of Sprintf?

Non-platform specific questions.

Contents of Sprintf?

Postby Hblade » Thu Sep 10, 2009 11:59 pm

Hey guys, We all know what sprintf does, and uh... well, I jsut want to know. HOW THE HECK does it let you ADD more to it? for example, here's one sprintf
sprintf(text, "Hi"); and here's another one
sprintf(text, Hi, my name is %d", name); O.o



Anyone have any idea how you can make a void that will allow you to add like that? I'm trying to make a function that allows you to have selections (Its for my new window creation method for creating PERFECT windows that will apear seamlesss and let you have selections in them)

For example...
CreateWindowSelections("window name", selection_ammount, "Type selections here", "Type Selections here"); See what I mean? :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Contents of Sprintf?

Postby pyrometal » Fri Sep 11, 2009 2:28 am

It seems GE is not capable of this since it lacks the ability to add headers... In C, you would include "stdarg.h" which contains the mechanisms to allow you to filter arbitray amounts of arguments passed to a function.

Well... GE allows you to pass undertermined amounts of arguments like you would expect actual C code to by doing this:

Code: Select all
myFunction(int arg1, ...)
{
    //code here
}


so "myFunction" can now be passed any amounts of arguments, but since you need "stdarg.h" and its special data types and functions to read and use these arguments, you cannot use them in any way... This is something that should be added sometime in GE's future hopfully. (unless it already exists in GE but haven't heard about how it is to be used...)

Anyway, hope I'm not breaking your bubble too much, ttyl Hblade!
SPRITE WARRIOR:
Free, open-source & crossplatform pixel art editor (currently under construction).
User avatar
pyrometal
 
Posts: 706
Joined: Wed Nov 28, 2007 4:07 am
Location: Kingston, ON, Canada
Score: 86 Give a positive score

Re: Contents of Sprintf?

Postby Hblade » Fri Sep 11, 2009 2:58 am

Thanks for the response, i'm going to have to find another way to do this.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron