Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: ae2k
  • Order by date
  1. ae2k

    C "tail" Functionality

    Wow excellent code newmangj... I can't believe how much less overhead your method has than what I was using previously. It still consumes slightly more resources than tail, but is incredibly more efficient than the err/clearerr method. Not only that, but detection of truncation was something I...
  2. ae2k

    C "tail" Functionality

    Your code works really well for a minute or two dchoulette, but always ends up terminating on a "Segmentation Fault". Any ideas what might be wrong?
  3. ae2k

    C "tail" Functionality

    Nevermind I got it working using fgets(), to stop on the endlines and EOFs: char buf[301]; // Start reading end of log file fseek(f_read, 0, SEEK_END); while(1) { fgets(buf, 301, f_read); if (feof(f_read)) { clearerr(f_read); } else {...
  4. ae2k

    C "tail" Functionality

    I tried this, and it *almost* works: char buf[301]; while(1) { fread(buf, 301, 1, f_read); if (feof(f_read)) { clearerr(f_read); } else { printf("%s\n",buf); } sleep(1); } The output is sometimes a single line and...
  5. ae2k

    C "tail" Functionality

    Thanks for the ideas, I'll try to see what I can come up with and get back to you how it went.
  6. ae2k

    C "tail" Functionality

    As I said I'm creating a routine... I'm not intending to recreate tail per se. The actual goal of the project is to multicast specific log messages to clients on the network. So far the line parsing and multicast server/client are complete and working. The only thing that remains to be done...
  7. ae2k

    C "tail" Functionality

    I'm attempting to create a C routine that mimics the behavior of "tail -f". The idea is to monitor a log file, and have a function called every time a new line is detected in the log (passing it the new line). This log file could possibly be written many times per second, so speed is a factor...

Part and Inventory Search

Back
Top