function Load($s_code)
 {
     global $FMCalc;
     $a_mesgs = array();
     // echo "Loading '$s_code'";
     if ($FMCalc->Parse($s_code, $a_mesgs) === false) {
         $s_msgs = "";
         foreach ($a_mesgs as $a_msg) {
             $s_msgs .= "Line " . $a_msg["LINE"];
             $s_msgs .= ", position " . $a_msg["CHAR"] . ": ";
             $s_msgs .= $a_msg["MSG"] . "\n";
         }
         Error("fmcompute_parse", GetMessage(MSG_COMP_PARSE, array("CODE" => AddLineNumbers($s_code), "ERRORS" => $s_msgs)), false, false);
     }
 }
Example #2
0
    $len = (string) $nr;
    $nrLen = strlen($len);
    $handle = fopen($S, "r");
    $testFile = fopen('file.txt', 'w');
    while (!feof($handle)) {
        $c++;
        $len = (string) $c;
        $l = strlen($len);
        $space = '';
        for ($i = 0; $i < $L - $l; $i++) {
            $space = $space . $K;
        }
        $a = $c . $space . fgets($handle);
        echo $a . "<br/>";
        fwrite($testFile, $a);
    }
    fclose($testFile);
    fclose($handle);
    $handle = fopen($S, "w");
    $testFile = fopen('file.txt', 'r');
    while (!feof($testFile)) {
        $a = fgets($testFile);
        //var_dump($a);
        fwrite($handle, $a);
    }
    fclose($testFile);
    fclose($handle);
}
echo readfile('test.txt') . '<br/><br/><br/>';
AddLineNumbers('test.txt', 5, ' ', 3);