Component index
Section index

Component savefile


Search

Type

Function

Summary

Overwrite a file with new content

Description

This will open the file, produce an error message if it can't be opened (unless openfail is used). Once the file is opened, start(), dowrite and end() are called in this order.

int dowrite (FILE *fout, const char *fname)
void end (FILE *fout, const char *fname)
void openfail (const char *fname)
void start (FILE *fout, const char *fname)

Examples

sample / savefile component

Prototypes

int savefile (const char *fname, bool append)

Return -1 if any errors

Functags

int dowrite (FILE *fout, const char *fname) Mandatory

Once the file is open, write all data at once

void end (FILE *fout, const char *fname) Optional

Do something once dowrite was called

void openfail (const char *fname) Optional

Called if the file can't be opened

void start (FILE *fout, const char *fname) Optional

Do something before dowrite() is called

The file is currently opened