fn='C:\Documents and Settings\Administrator\Desktop\crest3.tar';

data=[...
{'name',0,100};...
{'mode',0,8};...
{'user',0,8};...
{'group',0,8};...
{'size',0,12};...
{'modtime',0,12};...
{'chksum',0,8};...
{'link',0,1};...
{'lname',0,100};...
{'ustar',0,6};...
{'usver',0,2};...
{'uname',0,32};...
{'gname',0,32};...
{'maj',0,8};...
{'min',0,8};...
{'fnprefix',0,155};...
];

uu=num2cell(cumsum([0 data{1:end-1,3}]));
[data{:,2}]=deal(uu{:});

header=struct('field',{data{:,1}},'offset',{data{:,2}},'size',{data{:,3}});
Nh=length(header);

linktype={'file','hlink','slink','cs','bs','dir','fifo','cfile'};

finfo=dir(fn);
NB=fix(finfo.bytes/512);
fid=fopen(fn,'r');

off=512;
nf=1;
for nb=1:NB;
  block=fread(fid,512,'uchar');
  for nh=1:Nh
    head.(header(nh).field)=char(block(header(nh).offset+(1:header(nh).size))');
  end
  pause;
  if (head.ustar=='ustar ')
    hp(nf)=ftell(fid)-512;
    nf=nf+1;
    head
    skip=ceil(base2dec(head.size,8)/512)*512;
    off(nf)=off(nf-1)+skip+512;
    dec2hex(off(nf-1:nf))
    fseek(fid,skip,'cof');
    dec2hex(ftell(fid))
    [nb nf]
    pause;
  end
end
fclose(fid);