home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / unix / programm / 3950 < prev    next >
Encoding:
Text File  |  1992-07-28  |  1.1 KB  |  40 lines

  1. Newsgroups: comp.unix.programmer
  2. Path: sparky!uunet!mcsun!sunic!ericom!eos.ericsson.se!etxmesa
  3. From: etxmesa@eos.ericsson.se (Michael Salmon)
  4. Subject: Re: Better way to find out the number of lines in a file
  5. Message-ID: <1992Jul28.085037.5863@ericsson.se>
  6. Sender: news@ericsson.se
  7. Nntp-Posting-Host: eos6c02.ericsson.se
  8. Reply-To: etxmesa@eos.ericsson.se (Michael Salmon)
  9. Organization: Ericsson Telecom AB
  10. References:  <1992Jul27.195754.26812@tin.monsanto.com>
  11. Date: Tue, 28 Jul 1992 08:50:37 GMT
  12. Lines: 26
  13.  
  14. In article <1992Jul27.195754.26812@tin.monsanto.com>, bcschu@skws02.monsanto.com (Brett Schultz) writes:
  15. |> This is kind of similar to the how many files in a directory question, but
  16. |> is there a trick to find the number of lines in a file?
  17. |> 
  18. |> Thanks
  19. |> 
  20. |> Brett
  21. |> 
  22. |> PS
  23. |> 
  24. |> The files are big so I don't really want to do a gets loop with a counter
  25. |> unless I have to.
  26.  
  27. You certainly shouldn't use gets or fgets for that matter, use read or
  28. mmap and count the number of newlines.
  29.  
  30. -- 
  31.  
  32. Michael Salmon
  33.  
  34. #include    <standard.disclaimer>
  35. #include    <witty.saying>
  36. #include    <fancy.pseudo.graphics>
  37.  
  38. Ericsson Telecom AB
  39. Stockholm
  40.