473,805 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data Conversion

HI All

Does any one know how to convert a binary file into a readable (by human)
file? Its from a bin file, has addresses and stuff which I can work out...
but how do you do the actual conversion?

--
Regards
Dillon Mantle
Different Angle Solutions
072 300 0206
Jul 17 '05 #1
12 4927
> Does any one know how to convert a binary file into a readable (by human)
file? Its from a bin file, has addresses and stuff which I can work out...
but how do you do the actual conversion?

Thats like asking how to convert a book into something human readable.
The book is already human readable, unless the text it contains is not words,
but a bunch of random characters.

If the file is text, no conversion is necessary. If the file is not text, then
it will not be readable unless you know how to decypher its contents.
For example, how do you make a picture file, human readable? It does not
contain text, so you'll never get meaningful text from it.

If the file is encrypted text, then you need to know the decryption algorithm
to get the text back. No one here can tell you which algorithm to use, you need
to find out what needs to be done.

LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #2
Okay, let me be a little more specific.

The binary data is pulled from a piece of sporting equipment. The memory
extends from 0 to 1A6F, which is 564 data points at 12 bytes each. It is all
numbers, set format as below

interval type 1 byte 0 = distance, 1 = time, 2 =
stroke
time (1/64 sec interval) 3 bytes (72 hours)
distance 3 bytes (1.6+ million m by 1/16)
null byte 1 byte
avg stroke rate 2 bytes (0-255 by 1/256)
number of strokes 2 bytes (65000)

I can work out the memory bits, its just how do you convert "00000001" into
"1"

--
Regards
Dillon Mantle
Different Angle Solutions
072 300 0206
"Larry Serflaten" <Ab***@SpamBust ers.com> wrote in message
news:3f******** @corp.newsgroup s.com...
Does any one know how to convert a binary file into a readable (by human) file? Its from a bin file, has addresses and stuff which I can work out... but how do you do the actual conversion?

Thats like asking how to convert a book into something human readable.
The book is already human readable, unless the text it contains is not

words, but a bunch of random characters.

If the file is text, no conversion is necessary. If the file is not text, then it will not be readable unless you know how to decypher its contents.
For example, how do you make a picture file, human readable? It does not
contain text, so you'll never get meaningful text from it.

If the file is encrypted text, then you need to know the decryption algorithm to get the text back. No one here can tell you which algorithm to use, you need to find out what needs to be done.

LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Jul 17 '05 #3
Ahh, sounds to me like this person seeks a binary to decimal converter.

"Dillon Mantle" <di*****@dasolu tions.co.za> wrote in message
news:z_CdnQr7Er BoD2CiRVn-

I can work out the memory bits, its just how do you convert "00000001" into "1"

Jul 17 '05 #4
> Ahh, sounds to me like this person seeks a binary to decimal converter.

Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Integer
For X = 0 To Len(BinaryStrin g) - 1
Bin2Dec = Bin2Dec + Val(Mid(BinaryS tring, _
Len(BinaryStrin g) - X, 1)) * 2 ^ X
Next
End Function

Rick - MVP
Jul 17 '05 #5
"Rick Rothstein" <ri************ @NOSPAMcomcast. net> wrote in message news:<rd******* *************@c omcast.com>...
Ahh, sounds to me like this person seeks a binary to decimal converter.


Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Integer
For X = 0 To Len(BinaryStrin g) - 1
Bin2Dec = Bin2Dec + Val(Mid(BinaryS tring, _
Len(BinaryStrin g) - X, 1)) * 2 ^ X
Next
End Function


Or one without the extra subtractions and exponentiations ...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
For x = Len(BinaryStrin g) To 1 Step -1
Bin2Dec = Bin2Dec * 2 + CLng(Mid$(Binar yString, x, 1))
Next
End Function
Jul 17 '05 #6
> > > Ahh, sounds to me like this person seeks a binary to decimal
converter.

Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Integer
For X = 0 To Len(BinaryStrin g) - 1
Bin2Dec = Bin2Dec + Val(Mid(BinaryS tring, _
Len(BinaryStrin g) - X, 1)) * 2 ^ X
Next
End Function


Or one without the extra subtractions and exponentiations ...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
For x = Len(BinaryStrin g) To 1 Step -1
Bin2Dec = Bin2Dec * 2 + CLng(Mid$(Binar yString, x, 1))
Next
End Function


Yes, you could approach it that way too. (Remember, I was a math major in
college... I **like** using lots of the math operations in my
calculations.<g >)

However, you need to change the direction through the For-Next loop to this

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
For x = 1 To Len(BinaryStrin g)
Bin2Dec = Bin2Dec * 2 + CLng(Mid$(Binar yString, x, 1))
Next
End Function

The least significant bit of a binary string is at the right.

Rick - MVP
Jul 17 '05 #7
"Bob Butler" <bu*******@eart hlink.net> wrote
Ahh, sounds to me like this person seeks a binary to decimal converter.
Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Integer
For X = 0 To Len(BinaryStrin g) - 1
Bin2Dec = Bin2Dec + Val(Mid(BinaryS tring, _
Len(BinaryStrin g) - X, 1)) * 2 ^ X
Next
End Function


Or one without the extra subtractions and exponentiations ...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
For x = Len(BinaryStrin g) To 1 Step -1
Bin2Dec = Bin2Dec * 2 + CLng(Mid$(Binar yString, x, 1))
Next
End Function


Or one without multiplications or string lookups...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
Dim Bin() As Byte
Bin = BinaryString
For x = UBound(Bin) - 1 To 0 Step -2
Bin2Dec = Bin2Dec + Bin2Dec + (Bin(x) And 1)
Next
End Function

LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #8
> > > > Ahh, sounds to me like this person seeks a binary to decimal
converter.
Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Integer
For X = 0 To Len(BinaryStrin g) - 1
Bin2Dec = Bin2Dec + Val(Mid(BinaryS tring, _
Len(BinaryStrin g) - X, 1)) * 2 ^ X
Next
End Function


Or one without the extra subtractions and exponentiations ...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
For x = Len(BinaryStrin g) To 1 Step -1
Bin2Dec = Bin2Dec * 2 + CLng(Mid$(Binar yString, x, 1))
Next
End Function


Or one without multiplications or string lookups...

Function Bin2Dec(BinaryS tring As String) As Long
Dim x As Long
Dim Bin() As Byte
Bin = BinaryString
For x = UBound(Bin) - 1 To 0 Step -2
Bin2Dec = Bin2Dec + Bin2Dec + (Bin(x) And 1)
Next
End Function


Am I the one who is remember the binary number system incorrectly? Isn't the
least significant bit written on the right? For example, isn't 8 written as
1000 in binary? Your function has the same flaw as Bob's did... the loop
counter is backwards. I think your function should be...

Function Bin2Dec(BinaryS tring As String) As Long
Dim X As Long
Dim Bin() As Byte
Bin = BinaryString
For X = 0 To UBound(Bin) - 1 Step 2
Bin2Dec = Bin2Dec + Bin2Dec + (Bin(X) And 1)
Next
End Function

If I feed "1000" into your originally posted function, it returns 1. If I
feed it into the above revision, I get 8.

Rick - MVP


Jul 17 '05 #9
"Rick Rothstein" <ri************ @NOSPAMcomcast. net> wrote
If I feed "1000" into your originally posted function, it returns 1. If I
feed it into the above revision, I get 8.

Doh!

I tested it with 5! (101)

Thanks for the correction!

LFS


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5793
by: Zap | last post by:
Widespread opinion is that public data members are evil, because if you have to change the way the data is stored in your class you have to break the code accessing it, etc. After reading this (also copied below for easier reference): http://groups.google.it/groups?hl=en&lr=&safe=off&selm=6beiuk%24cje%40netlab.cs.rpi.edu&rnum=95 I don't agree anymore.
6
7961
by: New MSSQL DBA | last post by:
Hi all, we are now planning to upgrade our application from a non-unicode version to a unicode version. The application's backend is a SQL Server 2000 SP3. The concern is, existing business data are stored using collation "Chinese_PRC_CI_AS", i.e. Simplified Chinese. So I thought we need to extract these data out to the new SQL Server which is using Unicode (I assume it means converting them to nchar, nvarchar type of fields for I...
4
5017
by: Ivan | last post by:
I am running a statically bound COBOL program on DB2 7.1 OS/390 trying to insert EBCDIC strings into a varchar column in a table on DB2 UDB 7.2 FP10a Workgroup edition. The varchar column is defined as FOR BIT DATA which according to the SQL Reference - "Specifies that the contents of the column are to be treated as bit (binary) data. During data exchange with other systems, code page conversions are not performed." The problem I am having...
4
1717
by: wb | last post by:
Newbie at .net having trouble with data conversion. I am using the random constructor and trying to pass in seed value of time as instructed by help. rvalue = new random(int) dim x as long dim z as integer x = datetime.now.tick
1
2755
by: tony.fountaine | last post by:
I am working on a project to read a Bosch Measurement Data File (MDF). The file contains a number of blocks that can be read from the file using a baisc structure. For example the ID BLOCK is as follows, (Data Type) (Number of Elements) (Description) CHAR 8 File identifier, CHAR 8 Format identifier, CHAR 8 Program identifier,
0
1790
by: bpo_ccs | last post by:
We are into BPO and Software development business for past six and half years. We are looking for the following any kind of business from your end. Back Office Process Data Entry, Large Volume Data Processing, Data Conversion, Forms Processing, Process flow & Quality Data Entry Text, Numeric or Alphanumeric entry, Printed or Handwritten matter, Hardcopies or Scanned Images, Some typical examples include, Mortgage Documents, Abstract...
4
2055
by: alacrite | last post by:
I have a class that I want to turn its contents into csv file. I want to be able to set the value of the delimiter, the name of the file it gets saved to, the path of that file, and maybe a few other things. What would be a good design to accomplish these goals? Here are the ideas that I have come up with: Class X = class with data that I want to put into csv. 1. Nested Function Object use a nested function object to do the conversion.
23
9809
by: neha_chhatre | last post by:
which is the best format specifier(data type) if i have to work with decimal number. also please tell me the syntax for truncating a decimal number please reply as soon as possible
0
1869
by: dataentryoffshore | last post by:
Get a Discount up to 60% on data entry, data capture, dataentry services, large volume data processing and data conversion services through offshore facilities in India. Offshore data entry also provides form data entry, data capture, HTML/SGML coding, image scanning, file conversion with low cost, high quality,99.98% accuracy and time bound. Data Conversion Services offer cost effective data conversion projects, Outsourcing Data...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10613
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10368
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10107
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4327
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3846
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.