Public Member Functions | Data Fields

# FileWriter Struct Reference

Yes, simply writing to a file. More...

Inheritance diagram for FileWriter:

## Public Member Functions
| FileWriter (FILE *file)
| Create the file writer, so it writes to a specific file.
| ~FileWriter ()
| Make sure everything is cleaned up.
void | Write (byte *buf, size_t size)
| Write a given number of bytes into the savegame.
void | Finish ()
| Prepare everything to finish writing the savegame.
| FileWriter (const char *filename)
| Open a file to write to.
void | Finalise ()
| Finalise the writing.
virtual | ~FileWriter ()
| Make sure the file is closed.
## Data Fields
FILE * | file
| The file to write to.
FILE * | fh
| The file handle we're writing to.
const char * | filename
| The file name we're writing to.

## Detailed Description

Yes, simply writing to a file.

Base class for writing data to disk.

Definition at line 1847 of file saveload.cpp.

## Constructor & Destructor Documentation

FileWriter::FileWriter | ( | FILE * | file | ) | `[inline]`

Create the file writer, so it writes to a specific file.

Parameters:

  | file | The file to write to.

Definition at line 1854 of file saveload.cpp.

FileWriter::~FileWriter | ( |  | ) | `[inline]`

Make sure everything is cleaned up.

Definition at line 1859 of file saveload.cpp.

References Finish(), and SaveLoadParams::sf.

FileWriter::FileWriter | ( | const char * | filename | ) | `[inline]`

Open a file to write to.

Parameters:

  | filename | The file to open.

Definition at line 246 of file strgen.cpp.

References error(), and fh.

virtual FileWriter::~FileWriter | ( |  | ) | `[inline, virtual]`

Make sure the file is closed.

Definition at line 264 of file strgen.cpp.

References fh, filename, and free().

## Member Function Documentation

void FileWriter::Finalise | ( |  | ) | `[inline]`

Finalise the writing.

Reimplemented in LanguageFileWriter.

Definition at line 257 of file strgen.cpp.

References fh.

void FileWriter::Write | ( | byte * | buf,
|  | size_t | len |
| ) |  |  | `[inline, virtual]`

Write a given number of bytes into the savegame.

Parameters:

  | buf | The bytes to write.
  | len | The number of bytes to write.

Implements SaveFilter.

Definition at line 1867 of file saveload.cpp.

References file, and SlError().

The documentation for this struct was generated from the following files:

- src/saveload/saveload.cpp
- src/strgen/strgen.cpp