Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!lavaca.uh.edu!elroy!cosc6bp From: cosc6bp@elroy.uh.edu (A JETSON News User) Newsgroups: comp.lang.c Subject: /tmp file duration program questions. Message-ID: <5474.25cddf6b@elroy.uh.edu> Date: 6 Feb 90 02:17:47 GMT Organization: University of Houston Lines: 27 I am writing a program that will collect data on the number of files in the /tmp directory, and their lifetimes. I am going to do it by the following 'snapshot' method: 1) execute 'ls /tmp' 2) collect the output from ls either one at a time, or all at once. 3) compare it to an array or linked list of filenames already existing in /tmp. 4) Based on 3) add new file names to the list. 5) Also based on 3) write to a file the duration a file lasted that no longer exists in the /tmp directory and delete the name from the array or linked list. It would do the above in a forever loop until we decide to kill it. My questions are as follows: . What command would I use to execute 'ls /tmp' from C? . What is the most convenient way of routing the output from 'ls /tmp' back into the program so that it could be compared to the array or linked list? I think that a one line at a time feed would be best. Thanks for your interest, Ignacio Valdes - U of H - Home for the moment, of Andre Ware