File

The file type allows getting various information about files and performing input-output.

Methods

  • void construct(string path): create a new file object
  • bool exists: checks file existence
  • void delete: removes the file
  • string name: gets file name
  • string full_name: gets full file path
  • string ext: gets file extension
  • string dir: gets file directory path
  • int size: gets file size in bytes
  • void open: opens the file for reading and writing
  • void close: closes the file
  • void create: creates the file anew, removing the existing one if any
  • string read(int bytes): reads some bytes from the file
  • string read_all: reads the whole file
  • void write(string data): writes the data to file
  • int[] load_bytes: reads the whole file as an array of bytes (contained in ints)
  • bool[] load_bools: reads the whole file as an array of booleans
  • int[] load_ints: reads the whole file as an array of ints
  • float[] load_floats: reads the whole file as an array of floats
  • string[] load_bools: reads the whole file as an array of strings (separated by \r\n)
  • matrix load_matrix: reads the whole file as a matrix
  • void save_bytes(int[] data): saves the array of bytes (contained in ints) into the file
  • void save(bool[] data): saves the array of bools into the file
  • void save(int[] data): saves the array of ints into the file
  • void save(float[] data): saves the array of floats into the file
  • void save(string[] data): saves the array of strings into the file (separated by \r\n)
  • void save(matrix data): saves the matrix into the file

Last edited Mar 17, 2011 at 10:28 PM by impworks, version 1

Comments

No comments yet.