home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.pascal.borland      Borland Pascal was actually pretty neat      2,978 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,785 of 2,978   
   Jochen to All   
   Re: hex editor   
   18 Jun 05 17:33:25   
   
   From: jotel99@hotmail.com   
      
   Hi,   
      
   Grzegorz typed:   
      
   > i've tryed, but i've stuck at the very begining. I defineded file   
   > type as "file" and I assigned rtm.exe file. then I've tryed to view   
   > byte interpretation of file on screen, but error ocures "file not   
   > recognized: file format not recognized". it's only a test of reading   
   > files as bin, next I'm gonna have convert bin to hex. Anyone could   
   > help??   
      
   hmmm - took 5 min, maybe 10 :). code is untested!   
      
   program hexview;   
   uses crt;   
   const ch : string[16] = '0123456789ABCDEF';   
   var   
     fn : string;   
     f : file;   
     a : array[1..16] of byte;   
     w,i : word;   
   {$i-}   
   begin   
     write('filename: ');   
     readln(fn);   
     if fn='' then halt;   
     assign(f, fn);   
     reset(f, 1);   
     if ioresult<>0 then begin writeln('Ooops'); halt end;   
     writeln('Esc - to stop');   
     repeat   
       blockread(f, a, sizeof(a), w);   
       for i:=1 to w do   
         write(ch[succ(a[i] shr 4)]:2,ch[succ(a[i] and $f)]);   
       writeln;   
       if readkey = #27 then w:=0;   
     until w <> sizeof(a);   
     close(f);   
     writeln('Bye.');   
   end.   
      
   should work as a start - btw look at the online hilbe for commands like   
   seek...   
      
   good luck & greeets   
   jo   
      
      
   --   
   http://radio789.net.ms - Radio 789 - We play it ALL   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca