Difference between revisions of "$ferr"
From Scriptwiki
(occured -> occurred) |
|||
Line 3: | Line 3: | ||
− | Returns ''1'' if an error | + | Returns ''1'' if an error occurred, ''0'' else. |
Line 10: | Line 10: | ||
.[[fopen]] moo we_dont_have_this_file.txt | .[[fopen]] moo we_dont_have_this_file.txt | ||
; check whether $ferr returns 1 (true) and echo it | ; check whether $ferr returns 1 (true) and echo it | ||
− | [[if]] ($ferr) { [[echo]] -a An error | + | [[if]] ($ferr) { [[echo]] -a An error occurred. } |
− | ; else echo that no error | + | ; else echo that no error occurred. |
− | else { echo -a No error | + | else { echo -a No error occurred. } |
[[Category:File Handling]] | [[Category:File Handling]] |
Latest revision as of 08:31, 19 December 2005
Indicates there was a file error of some kind.
$ferr
Returns 1 if an error occurred, 0 else.
Example
; we open a file we probably don't have, but silently (the dot infront of the command) .fopen moo we_dont_have_this_file.txt ; check whether $ferr returns 1 (true) and echo it if ($ferr) { echo -a An error occurred. } ; else echo that no error occurred. else { echo -a No error occurred. }