Can Sscanf read a 64-bit number?

May 20, 2008
12,173
133
Syracuse, NY, USA
I'd like to get a HANDLE as an argument to a f_FUNCTION in a plugin. I suppose HANDLEs are 64 bits on 64-bit Windows. Any ideas?
 
May 20, 2008
12,173
133
Syracuse, NY, USA
You're using Visual C++, right? The RTL's sscanf() and swscanf() can do 64-bit integers.
http://msdn.microsoft.com/en-us/library/zkx076cy.aspx

(No, I don't know whether HANDLEs are larger in x64 Windows.)
A handle is a pointer (void*). So it should be 64 bits in 64-bit Windows. But it wouldn't surprise me a bit (no pun) if Windows kept HANDLEs (as opposed to more generic pointers to places in memory) below 32 bits. If that's so then Sscanf() would just stuff it into the low 32 bits of a 64-bit field, and that should be OK.

I like to avoid as much RTL stuff as I can. I'll bet using swscanf() would increase a plugin's size by 10K or so (static linking).

Edit: Make that 16K.
 
Last edited: