Original Post
Hello,
I am having a problem using swscanf under VC++ 6.0. My program crashes with an Access Violation during the swscanf call. What am I doing wrong?
I'd also be interested in the 'proper C++ way' to take a string in the form "2.1.3.2070" and extract the values 2, 1, 3, and 2070 into four integers. Thanks in advance!
-Glyph
[edited by - Glyph on May 15, 2003 4:10:52 PM]
#include <wchar.h>
int main ()
{
const wchar_t* versionString = L"2.1.3.2070";
int major = 0;
int minor = 0;
int revision = 0;
int build = 0;
swscanf (versionString,
L"%d.%d.%d.%d",
&major,
&minor,
&revision,
&build);
wprintf (L"Major = %4d\n"
L"Minor = %4d\n"
L"Revision = %4d\n"
L"Build = %4d\n",
major,
minor,
revision,
build);
return 0;
}