Article ID: 167326
Article Last Modified on 12/10/2003
/* Build Options: /Oi */
#include <stdio.h>
#include <string.h>
// uncomment the following line for workaround #2
//#pragma function(strcmp)
int main(void)
{
char somestr [15] = "Some String";
somestr[1] = 0;
// change the following to strcmp(somestr,"S") for workaround #1
if (strcmp(somestr,"S\0") == 0)
printf("match: correct\n");
else
printf("no match: incorrect\n");
return 0;
}
Note that a more common use of an embedded Null character may be to compare
a string to "\0" to see if it is an empty string. For the first workaround above,
compare it to "" instead.
Keywords: kbbug kbfix kbnoupdate kbprogramming kbcode KB167326