
7 RASExpress Script Language
CommPlete Communications Server 167
fdisplay("fgets failed^J^M");
goto error_exit;
endif
if fgetc(file_handle, str) then
fdisplay("fgetc done, char read is :%s^J^M", str);
else
fdisplay("fgetc failed^J^M");
goto error_exit;
endif
count = fread(file_handle, str, 5);
if count == 5 then
fdisplay("fread done^J^MBuffer read is :%s^J^M", str);
else
fdisplay("fread failed^J^M");
goto error_exit;
endif
origin = 1;
offset = 0;
position = fseek(file_handle, offset, origin);
if position != -1 then
fdisplay("current file offset is : %d^J^M", position);
endif
fclose(file_handle);
if isfile(file_name) then
fdisplay("%s exists^J^M", file_name);
else
fdisplay("%s does not exist^J^M", file_name);
endif
if delete(file_name) then
fdisplay("%s deleted^J^M", file_name);
else
fdisplay("%s could not be deleted^J^M");
endif
error_exit :
endproc
FDISPLAY fdisplay(string format_str {, integer | real | string argument}) : integer;
Displays the format string with all the arguments at the current cursor position. There
should be a one-to-one correspondence between the format control characters in the
format string and the arguments provided. If an argument provided does not match
the corresponding format control character it is ignored in the conversion. The
number of arguments converted is returned. For a detailed description of the format
control characters, see “Format String and Format Control Characters” on page 151.
Example
/* This script illustrates the fdisplay command. */
proc main;
string date_str;
string time_str;
display("Example for fdisplay command^J^M");
date(date_str);
time(time_str);
fdisplay("Current date is : %s, time is : %s^J^M", date_str,
➥ time_str);
endproc
Komentáře k této Příručce