about summary refs log tree commit diff
path: root/sourcecodes/example.php
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/example.php')
-rw-r--r--sourcecodes/example.php26
1 files changed, 17 insertions, 9 deletions
diff --git a/sourcecodes/example.php b/sourcecodes/example.php
index 47570aa2..d132bae8 100644
--- a/sourcecodes/example.php
+++ b/sourcecodes/example.php
@@ -47,16 +47,20 @@ $n=count($dataname);
 
 $initialstring="digraph G {\n"."size=\"6,8\";\n"."node [shape=square,width=1.5];\n";
 $endstring="}";
-fwrite($fout,"$initialstring");
+if ($fout !== false) {
+  fwrite($fout,"$initialstring");
+}
 
 $g_file_name=$dir.$keyval."grviz_name_file.txt";
 $grviz_name_file=fopen($g_file_name,"w");
 
-for($i=0;$i<$n;$i++)
-  {
-    $row_name=trim($dataname[$i]);
-    fwrite($grviz_name_file,"$row_name\n");
-  }
+if ($grviz_name_file !== false) {
+  for($i=0;$i<$n;$i++)
+    {
+      $row_name=trim($dataname[$i]);
+      fwrite($grviz_name_file,"$row_name\n");
+    }
+}
 
 for($i=1;$i<=$n;$i++)
   {
@@ -71,7 +75,9 @@ for($i=1;$i<=$n;$i++)
 	if($col_val==1)
 	  {
 	    $col_name=trim($dataname[$j]);
-	    fprintf($fout,"%s -> %s;\n",$ii,$j);
+	    if ($fout !== false) {
+	      fprintf($fout,"%s -> %s;\n",$ii,$j);
+	    }
 	    //fprintf($fouttemp,"%s -> %s;\n",$row_name,$col_name);
 
 	  }
@@ -79,8 +85,10 @@ for($i=1;$i<=$n;$i++)
 
 
   }
-fwrite($fout,"$endstring");
-fclose($fout);
+if ($fout !== false) {
+  fwrite($fout,"$endstring");
+  fclose($fout);
+}
 
 
 shell_exec('./run_scripts/run_octave '.$keyval);