home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!phys.ksu.edu!rjq
- From: rjq@phys.ksu.edu (Rob Quinn)
- Newsgroups: comp.unix.questions
- Subject: Re: question on fscanf
- Date: 24 Jan 1993 11:06:27 GMT
- Organization: Kansas State University
- Lines: 27
- Message-ID: <1jtt7jINNgj1@moe.ksu.ksu.edu>
- References: <1993Jan22.180730.1@vax1.umkc.edu>
- NNTP-Posting-Host: bohr.phys.ksu.edu
-
- In <1993Jan22.180730.1@vax1.umkc.edu> srinivasan@vax1.umkc.edu writes:
-
- Mail to you bounced.
-
- In comp.unix.questions you write:
- > Thanks a lot for all the people who responded to my question.
- >I am rephrasing the question now since i found that the fopen command
- >si returning a valid pointer but when i do a fscanf on the file utmp
- >(path = /etc/utmp) then it gives a segmentation fault. Can someone
- >explain this phenemenon.
-
- Yes, your program is broken.
- What more can we say with what you have given?
-
- >thank you
-
- But, some ideas. When I do a 'wc -l' on my /etc/utmp I see that
- it has 0 lines. That means there's no terminating \n. utmp is a
- binary file. What do you expect to be able to scan out of it?
- I would bet you are scanning some huge string into a small array.
- Did you look at the utmp man page? If I were scanning utmp, I would
- use open/read/close rather than stdio.
-
- --
- | Rob Quinn |
- | rjq@phys.ksu.edu |
- | QuinnBob@KSUVM.BITNET |
-