Name
hw_MakeVirtualFile -- compose virtual file name (V7.1)
Synopsis
int ok = hw_MakeVirtualFile(STRPTR dest, int len, struct hwMakeVFileInfo
             *mvf, struct hwTagList *tags);
Function
This function can be used to compose a virtual file name either from a memory source or from an existing file on disk. The virtual file name is written to the buffer passed in dest. The buffer size must be passed in len. After this function has succeeded, you can then pass the virtual file name to any of Hollywood's functions which are able to handle virtual files, for example hw_FOpen().

You also have to pass a pointer to a struct hwMakeVFileInfo structure to this function which contains the required information about the virtual file that is to be composed. struct hwMakeVFileInfo looks like this:

 
struct hwMakeVFileInfo
{
    STRPTR RealFile;    // [in]
    APTR MemoryBlock;   // [in]
    STRPTR FileExt;     // [in]
    DOSINT64 Offset;    // [in]
    DOSINT64 Length;    // [in]
};

Here's a description of the individual structure members:

RealFile:
If you wish the virtual file to take its data from a real file source, pass a pointer to the name of this file here. In this case, you also need to provide the Offset and Length fields. If the virtual file should use a memory source, set RealFile to NULL and use MemoryBlock instead.

MemoryBlock:
If you wish the virtual file to take its data from a memory block source, pass a pointer to the memory block here. In this case, you also need to provide the Length field. If the virtual file should use a real file source, set MemoryBlock to NULL and use RealFile instead.

FileExt:
This member must always be set, no matter if you use RealFile or MemoryBlock. You must set it to an extension that the virtual file should use, e.g. "jpg". This is used for internal hinting at the virtual file's contents. If the virtual file doesn't have any particular extension because it is in a custom data format, pass "bin" as FileExt.

Offset:
This is only used when RealFile is non-NULL. In that case, it specifies the byte offset into RealFile where the virtual file should start, i.e. the offset specified in Offset is equal to offset 0 inside the virtual file.

Length:
This is used for RealFile and MemoryBlock and it specifies the length of the virtual file in bytes. This member must always be set.

This function is thread-safe.

Designer compatibility
Unsupported

Inputs
dest
destination buffer for virtual file name
len
size in bytes of destination buffer
mvf
control structure containing virtual file parameters
tags
reserved for future use, pass NULL for now
Results
ok
True on success, False otherwise

Show TOC