System routines

Top  Previous  Next

file_reader class:

 function create_file_reader(file: string; encoding: integer): file_reader

         file - file path and name

         encoding - file encoding (windows)

 type file_reader = class

         procedure readln(var line: string) - reads from file until end of line sign encountered

         procedure seek(offset: integer; start: integer) - set file position to seek offset from start byte

         function eof: integer - returns 1 if end of file reached, return 0 otherwise

         function size: integer - integer returns size of file in bytes

         function getposition: integer - return current file position

         procedure setposition(value: integer) - set current file position

         property position: integer read getposition write setposition

 end

 

file_writer class:

 function create_file_writer(file: string; encoding: integer; create_flags: integer): file_writer

         file - file path and name

         encoding - file encoding (windows)

         create_flags - file create options

 type file_writer = class

         procedure writeln(line: string) - write line string to file and move to new line

         procedure write(s: string) - write s string to file

         procedure seek(offset: integer; start: integer) - set file position to seek offset from start byte

         function getposition: integer - returns current position

         procedure setposition(value: integer) - set file position

         property position: integer read getposition write setposition

 end

 

 function file_exists(file: string): boolean - returns true if file named file exists

 function start_process(cmd_line: string): boolean - start process with command line cmd_line

 function input_combo(capt: string; val_list: string_array50; def_index: integer): integer

         input dialog with combobox

         capt - dialog title

         val_list - list of items in combobox

         def_index - index of item that is initially selected

 

 function input_edit(capt: string): string

         input dialog with edit

         capt - dialog title

 

 function open_file_dialog(init_dir: string; title: string; filter: string; filter_index: integer): string

         system file open dialog

         init_dir - initial directory

         title - dialog title

         filter - file extension filter string

         filter_index - default filter

 

 function save_file_dialog(init_dir: string; title: string; filter: string; filter_index: integer): string

         system file save dialog

         init_dir - initial directory

         title - dialog title

         filter - file extension filter string

         filter_index - default filter

 

 function delete_file(file: string): boolean - delete file

 function dir_exists(dir: string): boolean - returns true if dir directory exists

 function rename_file(old, new: string): boolean

         rename file old to new

         returns true if operation successfull

 

 function get_cur_dir: string - returns current directory

 function set_cur_dir(dir_name: string): boolean

         set current directory to dir_name

         returns true if operation successfull

 

 function create_dir(dir_name: string): boolean

         create directory dir_name

         returns true if operation successfull

 

 function remove_dir(dir_name: string): boolean

         remove directory dir_name

         returns true if operation successfull

 

 function extract_file_name(file_name: string): string - returns file name part of file_name string

 function extract_file_dir(file_name: string): string - returns directory part of file_name string

 function extract_file_ext(file_name: string): string - returns extension part of file_name string

 

 var error_level: integer - error reporting control variable

 const el_default = 0 - report errors

 const el_no_report = 1 - don't report errors