Skip to content

A convenience wrapper for the PHYSFS library, for the D Programming Language.

Notifications You must be signed in to change notification settings

mdparker/Defile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Defile

A convenience wrapper for the PHYSFS library, for the D Programming Language. Note that this is currently incomplete and will be fleshed out over time. Use at your own risk.

##Usage

This is an example. There is more functionality not demonstrated here.

import defile.defile;

void main() {
    scope( exit ) Defile.terminate();
    Defile.initialize();

    // Read the entire content of a file.
    ubyte[] buf;
    Defile.readFile( "foo.bar", buf );

    // Manipulate the bytes.
    ...

    // Open a file for reading and read in smaller chunks.
    auto file = Defile( "foo.bar", OpenFor.Read );

    ubyte[] buf2;

    // Read 32 bytes
    file.read( buf2, 32, 1 );

    // Read 128 bytes
    file.read( buf2, 32, 4 );

    // Alternatively...
    file.read( buf2, 128, 1 );

    // Close if you want, but the destructor will do so automatically on scope exit.
    file.close();
}

About

A convenience wrapper for the PHYSFS library, for the D Programming Language.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages