No file method wont work.
Yes file method will work. :) The parent knows the pid of the child that just exited from the return value of
wait. If each child writes the value of the PROJECTNAME "environment variable" just before it exits (you still haven't explained why it
has to be an environment variable) to a file (pid.tmp, say), the parent can read the value of PROJECTNAME from the pid.tmp file.
You still haven't explained the bigger picture, what is the type of problem you are trying to solve, and why running multiple sub processes is a good way to solve it. And do you really need environment variables? Or do you just need a decent IPC mechanism?