Watch, Follow, &
Connect with Us
Public Report
Report From: EDN/Member services    [ Add a report in this area ]  
Report #:  131701   Status: Reported
swscanf return wrong result
Project:  EDN Build #:  ebmarcadero xe7
Version:    2 Submitted By:   Hisham K
Report Type:  Basic functionality failure Date Reported:  5/27/2015 5:05:51 AM
Severity:    Critical / Show Stopper Last Updated:
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 1
Description
i use embarcadero Xe7. I found that swscanf returns wrong result, when i try to read integer from string with spaces.
Steps to Reproduce:
int _tmain(int argc, _TCHAR* argv[])
{
char    *t1=  "  ";
wchar_t *t2= L"  ";
int     i1, i2;

  i1= -1;
  i1= sscanf (t1, "%d", &i2);  
  if(i1!=EOF)
    printf("sscanf output i1=%d i2=%d\n", i1, i2);  
  else
    printf("sscanf EOF\n");

  i1= swscanf(t2, L"%d", &i2);  
  if(i1!=EOF)
    printf("swscanf output i1=%d i2=%d\n", i1, i2);  
  else
    printf("swscanf EOF\n");

  return 0;
}

the result:

sscanf EOF  (Ok)
swscanf output i1=1 i2=0  (not ok)
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01