Main Page Modules Alphabetical List Compound List File List Compound Members File Members

# Data Loading functions
[Core PicoGUI API]

## Functions
pgmemdata | pgFromMemory (void *data, u32 length)
| Refer to data loaded into memory.
pgmemdata | pgFromTempMemory (void *data, u32 length)
| Refer to data loaded into memory, free when done.
pgmemdata | pgFromFile (const char *file)
| Refer to data in a file.
pgmemdata | pgFromStream (FILE *f, u32 length)
| Refer to data in an opened stream.

## Detailed Description

The pgFrom*() functions specify various ways to reference data using the pgmemdata structure.

## Function Documentation

struct pgmemdata pgFromFile | ( | const char * | file | ) |

  | Refer to data in a file. Parameters:
  file | The name of the file containing data to be referred to
Returns: A pgmemdata structure describing the data. This is needed by many PicoGUI API functions that require data as input. Depending on implementation the file may be loaded into memory temporarily, or memory-mapped if possible See also: pgFromMemory, pgFromTempMemory, pgFromStream

struct pgmemdata pgFromMemory | ( | void * | data,
|  | u32 | length
| ) |

  | Refer to data loaded into memory. Parameters:
  data | A pointer to data loaded into memory
  length | The length, in bytes, of the data referred to
Returns: A pgmemdata structure describing the data When using pgFromMemory, the data pointer must remain valid for a relatively long period of time, usually until the request buffer is flushed. If you would rather have the client library free the memory for you when it is done, see pgFromTempMemory See also: pgFromFile, pgFromStream, pgFromTempMemory

struct pgmemdata pgFromStream | ( | FILE * | f,
|  | u32 | length
| ) |

  | Refer to data in an opened stream. Parameters:
  f | C stream, as returned by `fopen()` in `stdio.h`
  length | The number of bytes to read from the stream
Returns: A pgmemdata structure describing the data Depending on implementation, the data may be read from the stream into memory, or memory-mapped if possible. The chunk of data referred to begins at the stream's current position and extends `length` bytes past it. The stream's position is advanced by `length` bytes. See also: pgFromMemory, pgFromTempMemory, pgFromFile

struct pgmemdata pgFromTempMemory | ( | void * | data,
|  | u32 | length
| ) |

  | Refer to data loaded into memory, free when done. Parameters:
  data | A pointer to data loaded into memory
  length | The length, in bytes, of the data referred to
Returns: A pgmemdata structure describing the data The data pointer must have been dynamically allocated with malloc() or equivalent. When the client library is done using it, `data` will be freed with the free() function. See also: pgFromMemory, pgFromFile, pgFromStream