VIRTUAL_FILE_SOURCE Struct Reference

#include <VirtualFile.h>

Data Fields

int(* fOpen )(void *param1, int param2, int type, int mode, VIRTUAL_FILE *f)
 
int(* fClose )(VIRTUAL_FILE *f)
 
int(* fRead )(void *ptr, size_t size, size_t n, VIRTUAL_FILE *f)
 
int(* fWrite )(const void *ptr, size_t size, size_t n, VIRTUAL_FILE *f)
 
int(* fGetc )(VIRTUAL_FILE *f)
 
int(* fPutc )(int caractere, VIRTUAL_FILE *f)
 
char *(* fGets )(char *str, int maxLen, VIRTUAL_FILE *f)
 
void(* fPuts )(const char *s, VIRTUAL_FILE *f)
 
void(* fSeek )(VIRTUAL_FILE *f, int offset, int whence)
 
int(* fTell )(VIRTUAL_FILE *f)
 
int(* fEof )(VIRTUAL_FILE *f)
 

Detailed Description

Structure of a Virtual File Source.

Field Documentation

int(* VIRTUAL_FILE_SOURCE::fOpen)(void *param1, int param2, int type, int mode, VIRTUAL_FILE *f)

Open a file.

Return 1 if anything went well, or 0 to throw an error (the opening will be cancelled and NULL will be returned to the user).

int(* VIRTUAL_FILE_SOURCE::fClose)(VIRTUAL_FILE *f)

Close a file.

Return 1 if anything went well, 0 to throw an error.

int(* VIRTUAL_FILE_SOURCE::fRead)(void *ptr, size_t size, size_t n, VIRTUAL_FILE *f)

Read in a file.

Returns the number of bytes effectively read.

int(* VIRTUAL_FILE_SOURCE::fWrite)(const void *ptr, size_t size, size_t n, VIRTUAL_FILE *f)

Write in a file

Returns the number of bytes effectively written.

int(* VIRTUAL_FILE_SOURCE::fGetc)(VIRTUAL_FILE *f)

Read a single character.

Returns the next character (byte) in the file.

int(* VIRTUAL_FILE_SOURCE::fPutc)(int caractere, VIRTUAL_FILE *f)

Write a single character

Writes a single character. Returns the character value if anything went well, -1 else.

char*(* VIRTUAL_FILE_SOURCE::fGets)(char *str, int maxLen, VIRTUAL_FILE *f)

Read a string

Reads a string to the buffer pointed to by str, of a maximum size of maxLen. Returns a pointer to the read string (str in general). Reading stops to the next carriage return found (\n). The routine should handle correctly the following sequences by reading them entirely: \r, \r\n, \n. If a \r is found, you should read the following byte and rewind one byte behind if it's not a \n. If you cannot afford a rewind, then keep the next character in cache and return it to the next read.

void(* VIRTUAL_FILE_SOURCE::fPuts)(const char *s, VIRTUAL_FILE *f)

Write a string

Writes an entire string to the file.

void(* VIRTUAL_FILE_SOURCE::fSeek)(VIRTUAL_FILE *f, int offset, int whence)

Moving in the file

Sets the current file position and returns the old one. The whence parameter uses the same values as stdio (SEEK_SET, SEEK_CUR, SEEK_END).

int(* VIRTUAL_FILE_SOURCE::fTell)(VIRTUAL_FILE *f)

Get current file position

Returns the current pointer position in the file. You can then use VirtualFileSeek(f, position, SEEK_SET) to return to it.

int(* VIRTUAL_FILE_SOURCE::fEof)(VIRTUAL_FILE *f)

End of file

Returns true (1) if it's the end of the file, false (0) else.


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