🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #13402

Lattice C sscanf bug ?

#13402
From: Arthur
Date: Wed, 10 Jan 1990 13:02
34 lines
1561 bytes
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
Technical Details
Message-ID: <F6C50A8E219F801E39@pttrnl.nl>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pttrnl.nl!AP_vRooijen

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!pttrnl.nl!AP_vRooijen
From: AP_vRooijen@pttrnl.nl (Arthur)
Newsgroups: comp.sys.amiga.tech
Subject: Lattice C sscanf bug ?
Message-ID: <F6C50A8E219F801E39@pttrnl.nl>
Date: 10 Jan 90 13:02:00 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Lines: 34