This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I call sscanf, but the compiler calls scanf instead!

The following codes show the problem.

#include <stdio.h>

void main() {
	char str[10];
	sscanf(str, "hello");
}
The call tree is:
OVERLAY MAP OF MODULE:   ssanfTst (MAIN)


SEGMENT                           BIT_GROUP          DATA_GROUP
  +--> CALLED SEGMENT          START    LENGTH     START    LENGTH
------------------------------------------------------------------
?C_C51STARTUP                  -----    -----      -----    -----
  +--> ?PR?MAIN?MAIN

?PR?MAIN?MAIN                  -----    -----      0021H    000AH
  +--> ?CO?MAIN
  +--> ?PR?SCANF?SCANF

?PR?SCANF?SCANF                0020H.0  0000H.6    002BH    001AH
  +--> ?PR?GETCHAR?UNGETCHAR
  +--> ?PR?_ISSPACE?ISSPACE
  +--> ?PR?GETCHAR?GETCHAR

?PR?GETCHAR?GETCHAR            -----    -----      -----    -----
  +--> ?PR?_GETKEY?_GETKEY
  +--> ?PR?PUTCHAR?PUTCHAR
Does compiler treat sscanf as a special case of scanf by setting a magic flag somewhere? That is, with the flag being set, the compiler, for example, doesn't call _getkey but read character directly from memory, right?
I'm looking for your help.
(Of course, the program shown above works correctly.)

0