×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# How I convert Array of different ASCII Values into an Integer ?

## How I convert Array of different ASCII Values into an Integer ?

(OP)
Hi, I have 1 DAT File in which numeric data is stored in unknown format. When I converted each Character of unknown format in Ascii Value, it gives me following ASCII Value but in Application, this data is displayed as following Decimal Interger Number.

Ascii Value Decimal Value
----------- -------------
127,30,32,32 7807 }
63,31,32,32 7999 } for Integers
96,31,32,32 8032 }

### RE: How I convert Array of different ASCII Values into an Integer ?

I'd suggest that, in each of your byte sequences:
• The first two bytes are an Intel (Little-Endian) short (16-bit) integers.
• The second two bytes (both ASCII 32, or hexadecimal 20) are space characters.
i.e.
• decimal 127 30 = hex L.E. 7f 1e = hex B.E. 1e7f = 7807
• decimal 63 31 = hex L.E. 3f 1f = hex B.E. 1f3f = 7999
• decimal 96 31 = hex L.E. 60 1f = hex B.E. 1f60 = 8032

### RE: How I convert Array of different ASCII Values into an Integer ?

(OP)

I have attached sample data file which contains the actual data in some unknown format and I have also converted this data in Ascii values.

Since the Actual Data contains different Data types like Integer, Float and Date, Please explain the steps of how this Ascii Values will be converted into Integer, Float Numbers and Date Format.

Also, Please let me know the language/Software in which this data of Unknown format is captured in the file.

Please go thru the attached Text File and waiting for your revert.

Rajesh Parmar

### RE: How I convert Array of different ASCII Values into an Integer ?

(OP)
Hi,

Pls ignore this reply if you have recieved the attached file in my earlier reply correctly. Also ignore "|" & "||" character as I have used this character as Seperator for better understanding.

a) Date Date Type ( like 16/02/2013) in unknown format :
_________________________________________________________

Date Ascii Values
<------------------------------------------->
|| üíÉÌB|, 32, 32,252, 2,237,201,204, 66||
|| X)òÉÌB|, 32, 32, 88, 41,242,201,204, 66||
|| ´O÷ÉÌB|, 32, 32,180, 79,247,201,204, 66||
|| ââùÉÌB|, 32, 32,226,226,249,201,204, 66||
|| vüÉÌB|, 32, 32, 16,118,252,201,204, 66||
|| lœÊÌB|, 32, 32,108,156, 1,202,204, 66||
|| ®¢Ê |, 32, 32,174,162, 19,202, 0, 0||

Note : Column Heading "Date" represent the date as actual data in file
and Column "Ascii Values" represent its corresponding Ascii Value
each Charaterwise.

b) Numeric Data Type : ( Integer and Float (Including Decimal Value like 123.515 ) ) in unknown format :

Int Ascii Values |
<------------------- >
| |, 1, 32, 32, 32|
| |, 1, 1, 32, 32|
|  |, 32, 1, 1, 32|
| |, 32, 32, 1, 1|
|B |, 66, 32, 32, 1|
|^@ |, 94, 64, 32, 32|
|¦? |, 1,166, 63, 32|
|? |, 63, 1, 32, 32|
|@ |, 8, 64, 1, 32|
| @|, 32, 8, 64, 1|
|\$@ |, 36, 64, 1, 32|

Float Ascii Values
<----------------------------------------->
| ü©ñÒMb|, 32, 1,252,169,241,210, 77, 98|
| ü©ñÒM|, 32, 32, 1,252,169,241,210, 77|
| ü©ñÒ|, 32, 32, 32, 1,252,169,241,210|
| ü©ñ|, 32, 32, 32, 32, 1,252,169,241|
| Ûù|, 32, 32, 32, 32, 32, 1,219,249|
| @|, 32, 32, 32, 32, 32, 32, 8, 64|
| &|, 1, 32, 32, 32, 32, 32, 32, 38|
|? |, 63, 1, 32, 32, 32, 32, 32, 32|
|P? |, 80, 63, 1, 32, 32, 32, 32, 32|
|bP? |, 98, 80, 63, 1, 32, 32, 32, 32|
|MbP? |, 77, 98, 80, 63, 1, 32, 32, 32|
|j¼t“? |,106,188,116,147, 63, 1, 32, 32|

Note : Column Heading "INT" and "Float" represent the actual data in file and Column "Ascii Values" represent its corresponding Ascii Value each Charaterwise.

Rajesh Parmar

### RE: How I convert Array of different ASCII Values into an Integer ?

Can't extract your file, and your "explanation" does not provide any suggested interpreted values (as per your initial question), so can only guess at formats:

• For dates and times, perhaps held as seconds, or ticks (100 nanoseconds) since a base date (e.g. 01 January year 0000, or (on some systems 1970!); look up "DateTime" structures.
• No idea about your 'numeric' data; perhaps binary coded decimal, or fixed-point values?
• For floating point values, probably held in IEEE floating point format.

### RE: How I convert Array of different ASCII Values into an Integer ?

(OP)
Hi,

Please find below with interpreted values.

a) Date Format :
-----------------

15/02/2007| üíÉÌB-|, 32, 32,252, 2,237,201,204, 66||
16/02/2007| *–ïÉÌB-|, 32, 32, 42,150,239,201,204, 66||
17/02/2007| X)òÉÌB-|, 32, 32, 88, 41,242,201,204, 66||
19/02/2007| ´O÷ÉÌB-|, 32, 32,180, 79,247,201,204, 66||
20/02/2007| ââùÉÌB-|, 32, 32,226,226,249,201,204, 66||
21/02/2007| vüÉÌB-|, 32, 32, 16,118,252,201,204, 66||
22/02/2007| ÿÉ -|, 32, 32, 32, 32,255,201, 0, 0||

b) Floating Point Numbers :
---------------------------

-ü©ñÒMbP?-|,252,169,241,210, 77, 98, 80, 63|| 0.001
-ü©ñÒMbP-|, 1,252,169,241,210, 77, 98, 80|| 0.001
- ü©ñÒMb-|, 32, 1,252,169,241,210, 77, 98|| 0.001
- ü©ñÒM-|, 32, 32, 1,252,169,241,210, 77|| 0.001
- ü©ñÒ-|, 32, 32, 32, 1,252,169,241,210|| 0.001
- ü©ñ-|, 32, 32, 32, 32, 1,252,169,241|| 0.019
- Ûù-|, 32, 32, 32, 32, 32, 1,219,249|| 0.005

c) Integer Numbers :
---------------------

-Û? -|,219, 63, 32, 32|| 3
-®@ -|, 1,174, 64, 32|| 11
- ¤A -|, 32, 1,164, 65|| 1
- O -|, 10, 32, 1, 79|| 3
-  -|, 13, 10, 32, 1|| 5
- -|, 76, 1, 13, 10|| 63
- -|, 32, 6, 1, 13|| 22

-Û? -|,219, 63, 32, 32|| 10
-®@ -|, 1,174, 64, 32|| 10
- ¤A-|, 32, 1,164, 65|| 10
- O-|, 10, 32, 1, 79|| 10
_ -|, 1, 13, 10, 32|| 38
- -|, 76, 1, 13, 10|| 10
- -|, 32, 6, 1, 13|| 10

-Û? -|,219, 63, 32, 32|| 16347
-®@ -|, 1,174, 64, 32|| 16558
- ¤A-|, 32, 1,164, 65|| 16804
- O-|, 10, 32, 1, 79|| 17020
- -|, 13, 10, 32, 1|| 16478
-  -|, 32, 6, 1, 13|| 16945

Please go thru above formats and let me know what are the steps of converting these ASCII values into interpreted values.

Rajesh Parmar

### RE: How I convert Array of different ASCII Values into an Integer ?

I don't have time to examine and attempt to convert your samples; why don't you try to do it yourself?

As regards dates, look up DateTime structures; it may help.

For floating point numbers:
• 252,169,241,210, 77, 98, 80, 63 is hexadecimal fc a9 f1 d2 4d 62 50 3f;
• if considered as being in Intel (Little-Endian) format, this would be hex 3f 50 62 4d d2 f1 a9 fc
• If this is interpreted as an IEEE 64-bit double floating point value, the value is 1.0e-3, which is 0.001.
For integer values, you seem to have three different interpretations of the same values!
For the first of the third set of such values:
• 219, 63, 2, 32 is hexadecimal db 3f 20 20
• if you ignore the pair of trailing space (32 = hex 20) characters, this leaves hex db 3f
• if considered as being in Intel (Little-Endian) format, this would be hex 3f db
• if this is interpreted as a 16-bit (short) integer (either signed or unsigned format), the value is 16347.

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!