The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 07-02-2009
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,762
No the search is line-by-line, fgets gets one line at a time. tmp[256] can read in as many as 255 chars. No line in the example text is longer than 40. No issue.

As a general solution, use tmp[LINE_MAX] where LINE_MAX is defined in limits.h Most UNIX tools limit line size to whatever LINE_MAX is for your system.