Balan Sinniah wrote:
> Currently I am doing ATM Network Simulation for my final project. The ATM
> Network Simulator is running in Linux using X-Windows but at the same
> time it can be run without using X-Windows in background mode. Every time
> the simulator finished running, it produces an output file in the same
> directory and it is in this form "SIM_SNAP.XXX". The "XXX" is a number (3
> digit). I think the number is the process id. If it is the process id
> then how can I read this file without knowing the process. I am
> running the simulator from another C program that is I am calling
> the.exe file using exec() function. How can I read the output file
> which the name is not specified???
It's easiest if you can deduce the filename. If the extension is
determined by the pid, and you're running the program by calling
fork() then exec(), the pid of the simulator process will be the value
returned by fork() to the parent process (calling exec() doesn't
change the pid).
If you can't deduce the filename, then I would suggest scanning the
directory (using opendir/readdir/closedir) before running the
simulator, and then scanning it again afterwards. That should make it
clear which file was created by running the simulator.
--
Glynn Clements <[EMAIL PROTECTED]>