Hey, I'm pretty new to C programming in a Linux environment and was wondering if I could get some help using log files. What I want to do is have my program write data to a log file (like /var/log/motord or something like that where a new file is being created) but I'm having a surprising amount of trouble figuring out how to go about this. Could someone perhaps post some example code that would do this sort of thing?
Also, is there a way to write a program that would, while it's running, print the lines that are being added to the log fill to the command prompt? Only while the program is running though and only the lines that are actively being sent, not the entire file. This is more of an after thought but I'm not really sure where to start with that either or if it's something that's even doable.
Just as a reference as well, these programs will be running on a remote system and I plan on accessing the command prompt via telnet. This really only affects the latter situation but I figured it would be good to specify.
Any help would be great. Thanks in advance