WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform
Get attributes of the entry

Rar::getAttr

(No version information available, might be only in CVS)

Rar::getAttrGet attributes of the entry

Description

Rar
int getAttr ( void )

Rar::getAttr() returns attributes of the archive entry.

Return Values

Returns the attributes or FALSE on error.

Examples

Example #1 Rar::getAttr() example

<?php

$rar_file 
rar_open('example.rar') or die("Can't open Rar archive");

$entry rar_entry_get($rar_file'dir/in/the/archive') or die("Can't find such entry");

$host_os $entry->getHostOs();
$attr $entry->getAttr();

switch(
$host_os) {
    case 
RAR_HOST_MSDOS:
    case 
RAR_HOST_OS2:
    case 
RAR_HOST_WIN32:
    case 
RAR_HOST_MACOS:
        
printf("%c%c%c%c%c%c\n",
                (
$attr 0x08) ? 'V' '.',
                (
$attr 0x10) ? 'D' '.',
                (
$attr 0x01) ? 'R' '.',
                (
$attr 0x02) ? 'H' '.',
                (
$attr 0x04) ? 'S' '.',
                (
$attr 0x20) ? 'A' '.');
        break;
    case 
RAR_HOST_UNIX:
    case 
RAR_HOST_BEOS:
        switch (
$attr 0xF000)
        {
            case 
0x4000:
                
printf("d");
                break;
            case 
0xA000:
                
printf("l");
                break;
            default:
                
printf("-");
                break;
        }
        
printf("%c%c%c%c%c%c%c%c%c\n",
                (
$attr 0x0100) ? 'r' '-',
                (
$attr 0x0080) ? 'w' '-',
                (
$attr 0x0040) ? (($attr 0x0800) ? 's':'x'):(($attr 0x0800) ? 'S':'-'),
                (
$attr 0x0020) ? 'r' '-',
                (
$attr 0x0010) ? 'w' '-',
                (
$attr 0x0008) ? (($attr 0x0400) ? 's':'x'):(($attr 0x0400) ? 'S':'-'),
                (
$attr 0x0004) ? 'r' '-',
                (
$attr 0x0002) ? 'w' '-',
                (
$attr 0x0001) ? 'x' '-');
        break;
}

rar_close($rar_file);

?>

See Also