bonassus Posted June 21, 2018 Share Posted June 21, 2018 I'm confused about printf. I don't know c++ and so never had to use it before leaning vex. I'm wondering about all letters you can use for the arguments in the printf function. I've seen %f used for a float. %d also used for float (decimal i guess), %s for string, and %i for integer. the docs state: The conversion of the argument is specified by a single letter: g, f, s, d, x, c, p. it goes on to show: %g, %p, %c Print an integer float, vector, vector4, matrix3, matrix or string in "general" form. %f, %e, %E Print a float, vector, vector4, matrix3 or matrix in floating point form. The first example shows 3 argument types and 7 data types. Does this mean i can use any of the listed %letter arguments with any of the data types shown? Quote Link to comment Share on other sites More sharing options...
acey195 Posted June 22, 2018 Share Posted June 22, 2018 (edited) generally yes ;), %d will work with most "number" types same as %f, the difference between them is mostly formatting I think. For instance with %d, it will limit the amount of decimals in the output string, whereas %f will try to keep as many digits behind the decimal point as possible. There are some other tricks that you could use, such as %02d. that will pad the start of the output with zeros, so you can do a more easy alpha-numeric search for example personally, I never had to use anything other than %f, %d or %s. Edited June 22, 2018 by acey195 gramarz 2 Quote Link to comment Share on other sites More sharing options...
bonassus Posted June 22, 2018 Author Share Posted June 22, 2018 Thanks a lot for your explanation. I think it should be added to the Houdini docs. much appreciated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.