[comp.sys.amiga] Lattice C sscanf bug ?

AP_vRooijen@pttrnl.nl (Arthur) (01/10/90)

Hello world,

I want to read the field width of a input format string. eg from "%5s" I want
to read 5. I'm using the following C program written with Lattice C 5.02

#include <stdio.h>

main()
{
        int n,field_width;
        char string[]="%5s";

        n=sscanf(string,"%%%ds",&field_width);

        printf("n=%1d,  field_width=%d\n",n,field_width);
}


The sscanf isn't working correctly. When I use the format string "%%ds" it is

        n=sscanf(string,"%%ds",&field_width);

Is this a bug from Lattice c 5.02 ?

    Arthur van Rooijen

RNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRN
*                                                                              *
*       PTT Research Neher Laboratorium,         Phone :  +31703325092         *
*       2260 AK Leidschendam,                    Telefax: +31703326477         *
*       P.O. box 421,                            E-mail: ap_vrooijen@pttrnl.nl *
*       The Netherlands.                                                       *
*                                                                              *
RNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRNLRN