Changed from popen to fopen.