home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!princeton!newross!samadams!tr
- From: tr@samadams.princeton.edu (Tom Reingold)
- Subject: Re: Using sed to convert numbers (interesting)
- Message-ID: <tr.712606300@samadams>
- Sender: news@newross.Princeton.EDU (USENET News System)
- Organization: Noo Joizy, USA
- References: <1992Jul31.121118.27783@news.acns.nwu.edu>
- Date: 31 Jul 92 18:11:40 GMT
- Lines: 20
-
- Without addressing your questions about sed, why not use a simple
- little C program, since scanf or sscanf will do what you want?
-
- #include <stdio.h>
-
- main()
- {
- char line[80];
- float f;
-
- while (gets(line) != NULL) {
- sscanf(line, "%f", &f);
- printf("%f\n", f);
- }
- }
- --
- Tom Reingold
- tr@samadams.princeton.edu OR ...!princeton!samadams!tr
- "Warning: Do not drive with Auto-Shade in place. Remove
- from windshield before starting ignition."
-