Approve the Cookies
This website uses cookies to improve your user experience. By using this site, you agree to our use of cookies and our Privacy Policy.
OK
Forums  •   • New posts  •   • RTAT  •   • 'Best of'  •   • Gallery  •   • Gear
Guest
Forums  •   • New posts  •   • RTAT  •   • 'Best of'  •   • Gallery  •   • Gear
Register to forums    Log in

 
FORUMS Community Talk, Chatter & Stuff The Lounge 
Thread started 10 Mar 2011 (Thursday) 16:06
Search threadPrev/next
sponsored links (only for non-logged)

hexnumber from many files in windows.

 
jonas18z
Member
39 posts
Joined Nov 2003
     
Mar 10, 2011 16:06 |  #1

I want to read the hexnumber in pos 29 on many files of a type (*.dat) and print it to a log + the path and filename.


What is the best method to do that in Windows?




  
  LOG IN TO REPLY
Jon
Cream of the Crop
Avatar
69,628 posts
Likes: 227
Joined Jun 2004
Location: Bethesda, MD USA
     
Mar 10, 2011 16:21 |  #2

Pretty much write a small app. Python maybe, or Java, or such since you'll need to translate the hex byte to its ASCII representation. For the adventurous, there's Cygwin (external link), so you can use UNIX-like commands under Windows.


Jon
----------
Cocker Spaniels
Maryland and Virginia activities
Image Posting Rules and Image Posting FAQ
Report SPAM, Don't Answer It! (link)
PERSONAL MESSAGING REGARDING SELLING OR BUYING ITEMS WITH MEMBERS WHO HAVE NO POSTS IN FORUMS AND/OR WHO YOU DO NOT KNOW FROM FORUMS IS HEREBY DECLARED STRICTLY STUPID AND YOU WILL GET BURNED.
PAYPAL GIFT NO LONGER ALLOWED HERE

  
  LOG IN TO REPLY
jonas18z
THREAD ­ STARTER
Member
39 posts
Joined Nov 2003
     
Mar 11, 2011 08:20 |  #3

Hi thanks

in putfile I want to read the 05 on pos 30
66 64 73 64 46 63 76 62 66 67 56 E7 FE 74 56 1D 44 54 46 6A 4D 0A 4E 04 01 70 0F 00 00 05 00 00 00 00 00 00 00 02 00 00


I tryed in python but:

infile = "test.dat"

FH = open(infile, 'rb')
FH.seek(30,0)
FH.tell()
line = FH.read(2)


print line

FH.close()

I don't output 05




  
  LOG IN TO REPLY
Jon
Cream of the Crop
Avatar
69,628 posts
Likes: 227
Joined Jun 2004
Location: Bethesda, MD USA
     
Mar 11, 2011 10:32 |  #4

OK - what is it returning? If the file is truly a binary file, you'll need to convert the 0x05 to ASCII "0" and "5". If the file's actually the ASCII dump of the binary, location 30 isn't going to be where byte 30 is stored; it's going to be more like where byte 15 is stored since an ASCII representation of a single byte needs 2 bytes.


Jon
----------
Cocker Spaniels
Maryland and Virginia activities
Image Posting Rules and Image Posting FAQ
Report SPAM, Don't Answer It! (link)
PERSONAL MESSAGING REGARDING SELLING OR BUYING ITEMS WITH MEMBERS WHO HAVE NO POSTS IN FORUMS AND/OR WHO YOU DO NOT KNOW FROM FORUMS IS HEREBY DECLARED STRICTLY STUPID AND YOU WILL GET BURNED.
PAYPAL GIFT NO LONGER ALLOWED HERE

  
  LOG IN TO REPLY
sponsored links (only for non-logged)

650 views & 0 likes for this thread, 2 members have posted to it.
hexnumber from many files in windows.
FORUMS Community Talk, Chatter & Stuff The Lounge 
AAA
x 1600
y 1600

Jump to forum...   •  Rules   •  Forums   •  New posts   •  RTAT   •  'Best of'   •  Gallery   •  Gear   •  Reviews   •  Member list   •  Polls   •  Image rules   •  Search   •  Password reset   •  Home

Not a member yet?
Register to forums
Registered members may log in to forums and access all the features: full search, image upload, follow forums, own gear list and ratings, likes, more forums, private messaging, thread follow, notifications, own gallery, all settings, view hosted photos, own reviews, see more and do more... and all is free. Don't be a stranger - register now and start posting!


COOKIES DISCLAIMER: This website uses cookies to improve your user experience. By using this site, you agree to our use of cookies and to our privacy policy.
Privacy policy and cookie usage info.


POWERED BY AMASS forum software 2.58forum software
version 2.58 /
code and design
by Pekka Saarinen ©
for photography-on-the.net

Latest registered member is AlainPre
1337 guests, 148 members online
Simultaneous users record so far is 15,144, that happened on Nov 22, 2018

Photography-on-the.net Digital Photography Forums is the website for photographers and all who love great photos, camera and post processing techniques, gear talk, discussion and sharing. Professionals, hobbyists, newbies and those who don't even own a camera -- all are welcome regardless of skill, favourite brand, gear, gender or age. Registering and usage is free.