Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP+Matrix1Utils] printf command

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 2nd Jul 2009 16:16
I made this printf command which is very similar to the C++ printf command:


Just put that in your code somewhere, and you can call it like this:


The string is printed out normally until it finds a % sign. The character following it decides what happens next:
c -> The character defined by a character code is printed out
i -> An integer is printed out
f -> A float is printed out
d -> A double float is printed out
o -> An integer is printed out in base 8
s -> A string is printed out
u -> A dword is printed out
x -> An integer is printed out in lower-case hexadecimal
X -> An integer is printed out in upper-case hexadecimal
% -> A percent sign is printed out

The command takes a variable number of arguments, and you should make sure that the parameters you pass in match up with the format characters within the string (if the first formatting character is 'i', the first argument after the formatting string should be an integer, etc.)

Enjoy

Login to post a reply

Server time is: 2024-11-22 01:41:13
Your offset time is: 2024-11-22 01:41:13