Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!ai-lab!opal!pc3!fiffi From: fiffi@opal.cs.tu-berlin.de (Carsten Hoehne) Newsgroups: comp.sys.amiga.programmer Subject: SAS-C problem (bug) with fscanf Message-ID: Date: 24 Mar 91 15:54:30 GMT Sender: fiffi@opal.cs.tu-berlin.de Reply-To: fiffi@opal.cs.tu-berlin.de Distribution: comp Organization: Technical University of Berlin, Germany Lines: 56 fscanf has the following template fsanf(File *file,char *format-string,...) The scanf fscanf sscanf routines of lc.lib doesn't work as described in the manual on page L96 ff. There is stated that if the format-string includes white spaces then white spaces are skipped in file. This description is similar to the UNIX scanf routines. Some examples to illustrate the problem. 1. fscanf(file,"\n") must skip any white spaces in file 2. fscanf(file,"%d\n",&i) should try to read an int in Variable i and then skip white spaces 3. fscanf(file,"\n%c",&c) must skip white spaces and then read a non blank character in the Variable c But ... SAS-C fscanf ignores any white spaces in the format-string so the above examples are evaluated not in the corrcet order. 1. is a do nothing operation 2. does not skip blanks after reading i 3. " " " " so c contains possible a blank character I will not work around this problem, since the routines are described correctly but implemented the wrong way. I detected this problem by porting OMEGA from UNIX to the AMIGA for my own. So other people have run in the same problem but they have possible ignored it. BTW is there any way to reach SAS via EMAIL? i have the version 5.1 I need an working version of fscanf very soon, when i started to port some of my real programms from UNIX to AMIGA so long Carsten -- Carsten Hoehne | e-mail: fiffi@opal.cs.tu-berlin.de Potsdamer Str.61 | fiffi@tubopal.UUCP 1000 Berlin 30 | ...!{unido,pyramid}!tub!opal!fiffi -------Germany | fiffi%tubopal@DB0TUI11.BITNET