I/O routines

Macros

#define VirtualFileWrite(ptr, size, n, f)   (VirtualFileGetSource(f)->fWrite(ptr, size, n, f))
 
#define VirtualFileRead(ptr, size, n, f)   (VirtualFileGetSource(f)->fRead(ptr, size, n, f))
 
#define VirtualFileGetc(f)   (VirtualFileGetSource(f)->fGetc(f))
 
#define VirtualFilePutc(caractere, f)   (VirtualFileGetSource(f)->fPutc(caractere, f))
 
#define VirtualFileGets(str, maxLen, f)   (VirtualFileGetSource(f)->fGets(str, maxLen, f))
 
#define VirtualFilePuts(s, f)   (VirtualFileGetSource(f)->fPuts(s, f))
 
#define VirtualFileSeek(f, offset, whence)   (VirtualFileGetSource(f)->fSeek(f, offset, whence))
 
#define VirtualFileTell(f)   (VirtualFileGetSource(f)->fTell(f))
 
#define VirtualFileEof(f)   (VirtualFileGetSource(f)->fEof(f))
 

Detailed Description

Routines for reading / writing to a virtual file. Make sure to check the Virtual File main page to know how to open files, etc.

Macro Definition Documentation

#define VirtualFileWrite (   ptr,
  size,
  n,
 
)    (VirtualFileGetSource(f)->fWrite(ptr, size, n, f))

Writes in a file and returns the number of bytes effectively written.

#define VirtualFileRead (   ptr,
  size,
  n,
 
)    (VirtualFileGetSource(f)->fRead(ptr, size, n, f))

Reads in a file and returns the number of bytes effectively read.

#define VirtualFileGetc (   f)    (VirtualFileGetSource(f)->fGetc(f))

Reads a single character. Returns the next character (byte) in the file.

#define VirtualFilePutc (   caractere,
 
)    (VirtualFileGetSource(f)->fPutc(caractere, f))

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

#define VirtualFileGets (   str,
  maxLen,
 
)    (VirtualFileGetSource(f)->fGets(str, maxLen, f))

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, \r\n or \r), supporting files created by every OS (I think).

#define VirtualFilePuts (   s,
 
)    (VirtualFileGetSource(f)->fPuts(s, f))

Writes a string to the file.

#define VirtualFileSeek (   f,
  offset,
  whence 
)    (VirtualFileGetSource(f)->fSeek(f, offset, whence))

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).

#define VirtualFileTell (   f)    (VirtualFileGetSource(f)->fTell(f))

Returns the current file pointer.

#define VirtualFileEof (   f)    (VirtualFileGetSource(f)->fEof(f))

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