I've read several articles on this topic, but some say that the way it should be done depends on the architecture and system you're in (Windows/Linux), so is there a proper way to do this platform independent?
1 Answer
%zu for size_t, with
%zfor length, and%ufor unsigned
Details can be found at
7.21.6.1 The fprintf function
6 The flag characters and their meanings are:
...
z Specifies that a following d, i, o, u, x, or X conversion specifier applies to a size_t or the corresponding signed integer type argument; or that a following n conversion specifier applies to a pointer to a signed integer type corresponding to size_t argument.
zuformat specifier%zuin VS2015."%zu","%zo","%zx", or"%zX"depending on what base you prefer.