\( % Arcus cosine. \def\acos{\cos^{-1}} % Vector projection. \def\projection#1#2{{proj_{#1}\left(#2\right)}} % Vector rejection. \def\rejection#1#2{{rej_{#1}\left(#2\right)}} % Norm. \def\norm#1{{\left\|#1\right\|}} % Cross product. \def\cross#1#2{\mathit{cross}\left(#1,#2\right)} % Dot product. \def\dot#1#2{{#1 \cdot #2}} % Magnitude. \def\mag#1{{\left|#1\right}} \def\group#1{\left(#1\right)}} \def\sbgrp#1{\left\{#1\right\}} \)

Ring1_FileSystem_getFileContents

Gets the contents of a file.

Ring1_Result
Ring1_FileSystem_getFileContents
  (
    char const *pathname,
    Ring1_FileSystem_Allocate *allocate,
    Ring1_FileSystem_Deallocate *deallocate,
    void **bytes
    size_t *numberOfBytes
  )

This function gets the contents of a file.

Parameter variables

pathname
The pathname of the file.
allocate
A pointer to a Ring1_FileSystem_Allocate function.
deallocate
A pointer to a Ring1_FileSystem_Deallocate function.
bytes
A pointer to a void * variable.
numberOfBytes
A pointer to a size_t variable.

Return Values

Ring1_Result_Success on success, Ring1_Result_Failure on failure.

Post Conditions

If this function fails, then it sets the by-thread status variable.

Below is a list of failure conditions and the status codes indicating them.

Ring1_Status_InvalidArgument
pathname, allocate, deallocate, bytes, and/or numberOfBytes, is NULL.
Ring1_Status_AllocationFailed
An allocation failed.
Ring1_Status_EnvironmentFailed
File does not exist.
Ring1_Status_EnvironmentFailed
File exists but is not of the right category.
Ring1_Status_EnvironmentFailed
Getting the file's contents failed.

If this function fails, neither bytes nor numberOfBytes are dereferenced.

If this function succeeds, *numberOfBytes is assigned the number of Bytes of the contents of the file and *bytes is assigned an array with the Byte values of the contents of the file.