File

Simple file reading utilities

It

The file objects

self {
  FILE* handle
  I64 size
}

open

Open a file for reading

File open(const I8* filePath)

Parameters

  • filePath — Path to the file

Returns — The file


close

Close an open file

U0 close(File file)

Parameters

  • file — The file

read

Read the entire file contents into a heap-allocated string

I8* read(File file)

Parameters

  • file — The file

Returns — Null-terminated file contents — caller must free