Question

What is the meaning of the format control specifier "%S\%016I64X%S" in this sprintf_s command ?

As far as I know, it defines a string which converts numbers to unsigned 64 bit integer in Hexadecimal format. I would like to know whether I am right ? Please help me..

char lFileName[MAX_PATH];
sprintf_s( lFileName, MAX_PATH, "%S\\%016I64X%S", mSavePath.GetBuffer(),aBuffer->GetTimestamp(), lExt );
Was it helpful?

Solution

First, it looks like a Visual C++ usage of

int sprintf_s(char *buffer, size_t sizeOfBuffer, const char *format, ...);

The format consists of multiple directives: "%S", "\\", "%016I64X", "%S".

"%S" "When used with printf functions, specifies a wide-character string; ..." more

"\\" is simply a \.

"%016I64X" is an X format specifier of hexadecimal output. 0 to indicate zero-filling as needed. 16 to indicate the minimum output length. I64 is a windows specific modifier indicating the expected integer is of windows specific type unsigned __int64. more

You are on the right track with "unsigned 64 bit integer".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top