I saw this function in some code and I can't find documentation on google about it. Can someone explain what it does and are there any alternatives to this ?
Thanks.
When we use the %n specifier in scanf() it will assign the number of characters read by the scanf() function until it occurs.
sscanf() Return value If successful, the sscanf() function returns the number of receiving arguments successfully assigned. If a matching failure occurs before the first receiving argument was assigned, returns zero. If input failure occurs before the first receiving argument was assigned, EOF is returned.
See http://msdn.microsoft.com/en-us/library/tsbaswba%28VS.80%29.aspx: it is a generic name for sscanf_s
.
EDIT: which is conveniently documented here. _stscanf_s
is in TCHAR.H on Windows platforms. You can probably get away with using sscanf_s
or swscanf_s
.
This MSDN article shows the _stscanf_s
variant of their "secure" sscanf
replacements:
http://msdn.microsoft.com/en-us/library/t6z7bya3(v=vs.80).aspx
It is a TCHAR
variant, which means that it should be able to support ANSI characters, and Unicode/Multi-byte, depending on how the app is compiled.
You could (somewhat) replace it with sscanf
on a more generic C/C++ implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With