Logo Search packages:      
Sourcecode: akode version File versions  Download package

bool aKode::MMapFile::seek ( long  to,
int  whence = SEEK_SET 
) [virtual]

Seeks to the position. Behaves semantically as lseek.

Implements aKode::File.

Definition at line 97 of file mmapfile.cpp.

                                       {
    if(!handle) return false;

    long newpos = 0;
    switch (whence) {
        case SEEK_SET:
            newpos = to;
            break;
        case SEEK_CUR:
            newpos = pos + to;
            break;
        case SEEK_END:
            newpos = len + to;
            break;
        default:
            return false;
    }
    if (newpos > len || newpos < 0)
        return false;
    pos = newpos;
    return true;
}


Generated by  Doxygen 1.6.0   Back to index