Another Sscanf question

May 20, 2008
11,285
95
Syracuse, NY, USA
If I do this,

Sscanf(psz, L" %u-%u-%u%*[ ,]%u:%u:%u%*[ ,]%c",
&st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond, &c)

with the string "2008-11-19 00:00:00 u", Sscanf (correctly?) returns 7 (assignments made) and c is assigned.

But if I do

Sscanf(psz, L" %u-%u-%u%*[ ,]%c",
&st.wYear, &st.wMonth, &st.wDay, &c)

with the string "2008-11-19 u"

Sscanf returns 3 (where 4 is expected?) and c is not assigned.

What's going on?
 
May 20, 2008
11,285
95
Syracuse, NY, USA
Never mind. It was my fault. I had an extra character in the second example's format string which was screwing up the search.

If I do this,

Sscanf(psz, L" %u-%u-%u%*[ ,]%u:%u:%u%*[ ,]%c",
&st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond, &c)

with the string "2008-11-19 00:00:00 u", Sscanf (correctly?) returns 7 (assignments made) and c is assigned.

But if I do

Sscanf(psz, L" %u-%u-%u%*[ ,]%c",
&st.wYear, &st.wMonth, &st.wDay, &c)

with the string "2008-11-19 u"

Sscanf returns 3 (where 4 is expected?) and c is not assigned.

What's going on?
 
Similar threads
Thread starter Title Forum Replies Date
vefatica How do I Sscanf for double,double? Plugins 0
vefatica Is Sscanf() OK? Plugins 5
vefatica Can Sscanf read a 64-bit number? Plugins 2
vefatica Sscanf()? Plugins 7
vefatica Sscanf()? Plugins 2
vefatica Sscanf()? Plugins 10
vefatica Sscanf()? Plugins 1
vefatica Tough (?) programming question Plugins 5
vefatica Question about screen buffer handles Plugins 2
vefatica Question for someone with sysutils and Windows 10 Plugins 4
vefatica Question for Rex Plugins 1
Charles Dye SearchPaths() question Plugins 4
vefatica Question for Rex Plugins 0
Charles Dye A weirdoid plugin question Plugins 6
Charles Dye Keystroke plugins question Plugins 7
vefatica A question for Rex Plugins 5
S How to? SafeChars.dll question Plugins 4
Charles Dye Binary buffers question Plugins 0
M Just a curiosity question related to the "default" set of re-mapped characters... Plugins 2
vefatica Question about Ctrl events Plugins 2
vefatica Generic programming question Plugins 2
vefatica Compiler question Plugins 8
vefatica Plugin keyhandler observation/question Plugins 15
vefatica PLUGININFO question Plugins 9
vefatica Plugin keyhandler question Plugins 1
vefatica Pipe question Plugins 6
vefatica Code page question Plugins 2
vefatica Unicode question (revisited, question for Rex) Plugins 0
vefatica Sprintf question Plugins 1
vefatica Unicode question Plugins 13
vefatica Question about GetToken() Plugins 7
vefatica Plugin question Plugins 3
vefatica NthArgument() question Plugins 1
vefatica Ctrl handling question Plugins 8
vefatica Message pumping question Plugins 12

Similar threads