home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!dog.ee.lbl.gov!news!manta!mitch
- From: mitch@nosc.mil (Ray Mitchell)
- Subject: Scanf field width macro?
- Message-ID: <1992Dec28.213129.8983@nosc.mil>
- Organization: Naval Ocean Systems Center, San Diego, CA
- Date: Mon, 28 Dec 1992 21:31:29 GMT
- Lines: 16
-
-
- Consider the statements
-
- printf("%*s", field_width, char_buffer);
- scanf("%5s", char_buffer);
-
- I would like to avoid embedding the magic field width constant in the
- scanf. I don't need it to be a variable field width like in printf
- but only need it to be in terms of some constant width macro I've
- previously defined. I've tried various things using stringization,
- token pasting, etc. to no avail. A solution which does not depend
- on some non-standard preprocessor/compiler behavior is required.
-
- Thanks,
- Ray Mitchell
- mitch@nosc.mil
-