C 5.10 sscanf() Does Not Work with F Format Specifier Prefix

ID Number: Q30450

5.10

MS-DOS

buglist5.10 fixlist6.00

Summary:

Page 502 of the "Microsoft C 5.10 Optimizing Compiler Run-Time Library

Reference" manual implies that you can use F to indicate to the

sscanf() function that you want to read from a buffer located in a far

data segment. This feature does not work correctly in C 5.10 because

an attempt to use the F specifier results in an "R6001 - Null pointer

assignment" error.

Microsoft has confirmed this to be a problem in C version 5.10. This

problem was corrected in C version 6.00.

The sample code below demonstrates this problem. When compiled and run

with C 5.10, the R6001 error occurs. Compiling the program with C 6.00

allows it to run correctly.

Sample Code

-----------

#include <stdio.h>

#include <stdlib.h>

#include <malloc.h>

char far farbuffer[] = "Far Buffer";

char nearbuffer[] = "Near Buffer";

main()

{

char far *farbufptr;

int retval;

printf ("Far Buffer = %Fs\n",farbuffer);

farbufptr = (char far *)farbuffer;

printf ("farbufptr = %Fs\n",farbufptr);

retval = sscanf(nearbuffer,"%Fs",farbuffer);

printf ("nearbuffer = %s\n",nearbuffer);

}