Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!labrea!decwrl!armory.dec.com!williamsm From: williamsm@armory.dec.com Newsgroups: comp.lang.c Subject: QUES: fprintf - include white space Message-ID: <11084@decwrl.DEC.COM> Date: Tue, 28-Jul-87 10:23:06 EDT Article-I.D.: decwrl.11084 Posted: Tue Jul 28 10:23:06 1987 Date-Received: Wed, 29-Jul-87 06:34:37 EDT Sender: daemon@decwrl.DEC.COM Organization: Digital Equipment Corporation Lines: 50 Hello out there. This is my first time posting in this area (,although I've watched this area for quite some time ), so please excuse me for any thing that i happen to do wrong. My question concerns the function fscanf() on the vax. How do I use fscanf() in such a way that it bring in the specified number of characters including white space (more importantly ' '), with out terminating the input to each field because of the white space. The example below shows the mothod discused in the book written by Rex Jaeschke, which does not seem to work (7-23). This example work if there is no white space with in the fields. and the [...] suppress is not specified. for(rec=0;(feof(fp)==0);rec++) /* read until end of file */ { fscanf(fp,"%[^/n]10s%[^/n]25s%[^/n]10s%[^/n]4s%[^/n]4s", &Master[rec].unit_sub, &Master[rec].descript, &Master[rec].serial_no, &Master[rec].rev, &Master[rec].qty); { pad(rec); printf("\n[%c] %s %s %s %s %s", /* print contents to screen */ ((char *)(rec+65)), Master[rec].unit_sub, Master[rec].descript, Master[rec].serial_no, Master[rec].rev, Master[rec].qty); } } fclose(fp); return(rec); Thanks in advance. (GONE -------- LIKE THE WIND) MELVIN WILLIAMSMS ARMORY::WILLIAMSM