Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




How To Convert Raw Binary Into Ascii Hex


i need to know how to convert raw binary into ascii hex, i searched around but couldnt find anything on it. anyone know?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Convert Ascii To Binary
Hi all.
I have a bit of a problem. I am getting a value from an OCX and it is in ascii. How can I convert the string so that it shows the binary representation of these values?

I.E. I get the value "Hi" "H" is 072 ascii and "i" is 105 ascii.

Then turning and converting those values to binary so that I get

"010010001101001" the binary equivilant.

Any help would be GREATLY appreciated

Convert Binary To ASCII
I'd like to convert binary code into ASCII. Does anyone have any code that could pull that off?? Thanx in advance!

How To Convert Ascii Into Binary
Hi,
I want to know that how we can convert our ascii text into binary one.

Convert Binary To Ascii
I am not familiar with binary file access, so forgive me if this is obvious:

When opening and reading a binary file, how do you convert it to Ascii?

Convert Ascii To Binary( 0[zeros] And 1[ones])
Most of you should know what binary is! I don't know how to do this:
convert ASCII characters to binary any help?
THANKS!

------------------
DiGiTaIErRoR

Convert Binary Value To ASCII (NEVER MIND, RESOLVED))
What is an easy way for that ?




Thank ya all!

Convert A Binary File To Ascii String
Dear All:

I have a problem on converting a binary file to a Ascii String.
The following is a sub to convert an input binary String to ascii string but I found that
it does not working
Can someone point out where did I do wrong???

Thanks in advance


public Sub Bin2Asc(strBin as string, strAsc as string)
Dim lLen as Long, i as Long, strBin2 as string
lLen = len(strBin)
strAsc = ""
for i = 1 to lLen
Dim strTmp as string
Dim btByte as Byte
strTmp = Hex(Asc(mid$(strBin, i, 1)))
If len(strTmp) < 2 then
strTmp = "0" & strTmp
else
If len(strTmp) = 4 then
lLen = lLen - 1
End If
strAsc = strAsc + strTmp
If i = lLen then
Exit for
End If
next i
End Sub

How To Convert Binary Code To Ascii Code
Does anyone know how to convert binary file to text file

Binary ASCII Hex Conversions And Reading From Binary File
A coworker has dumped a task off on me and I am not sure were to even look for what I need. First I need to read a binary file. then I need to take this information and display the information in Hex(in a text box). For my own use I would like to disply the binary information in a text box (as 0's and 1's) and the decimal value of the binary information.

Here is copy of my program, currently messy & clunky and in need of streamlining, but I figure other people might whant the code & it should make a good starting point for some one elses program
Thanks for the Help every one!!!!



Edited by - NcNghtStkr on 8/23/2005 7:13:17 PM

Convert Ascii Constant To Ascii Value With Program
How would I go about doin the following? If a string contains "vbKeyF1", how would i get vbKeyF1's ASCII value equivalent (ie: 112) to be written in another string?



Edited by - Marce22 on 10/10/2003 7:04:38 PM

Binary To Ascii
Me again, how do you open a binary file , convert it to ascii and put that in a txtbox? I have tried, at the top I can read my location but then its just unreadable data, it doesnt look like binary or hex to me;


Quote:




X v (gCQ @ l*o MIBOOK +gCN @ /3h WARBOOK O e4 @ -lN2 -gCG




is that encrypted?

Binary To Ascii
Is there a possibility to convert Binary file into ASCII file using VB?

Thank you.

Ascii Into Binary
Is thier a simple command in VB to change a string of Ascii charaters into a string of thier Binary conterparts? I could do it with a long If statment in a loop, but you guys are quite clever so I thought I'd ask anyway.

Cheers
~ichar

ASCII File To Binary
Hello all,

I want to convert an Ascii file to binary. Is it possible thro' vb??

Some details are as follows:
I am using a library Roper Scientific Winx/32 automation for grabing images from a camera. Now this supports four formats.i.e Ascii,tif8,tiff,spe. I'm saving this image as ascii. This is because resolution changes using tif8 ot tiff format. And spe format is not detected through Matlab in which i want to finally read this image.This is it. So i think somehow i will be able to convert this ascii file to binary so that i can read it through matlab.So can u ppl help me in this?

Thanks & Regards

ASCII To Binary Conversion
Which function in VB accepts ASCII numbers (or string character) and returns its Binary equivalent.

e.g. I should pass it 65 (ascii of A), it should return 01000001, etc.

And which one does the opposite, I pass it binary and it should return its ascii.

Thanks,

Pradeep

Converting Ascii To Binary
Is it possible to convert to binary and from binary?

Binary Data To ASCII
Hello ppl,

I want to convert binary data (found in a exe file eg) to ASCII to send it via the internet in my prog.

First I want to open the binary file (eg HelloWorld.exe) and convert the contents to a ASCII file (eg HelloWorld.txt). Now I can open this file and send to with my winsock prog.

The other side should get the ASCII and convert it back to the binary exe file.

Now I know how to send etc, but now the converting problem...

Please help me out here.

Converting Ascii To Binary
any body knows how to convert ascii code to binary code?

thks for helping in advance

Binary --> Ascii Chars Help
This cuts off the end character of the text it's processing. How do I fix this?
Code:Private Sub Command1_Click()
Dim txtarray() As String
txt = Text1.Text
txtarray = Split(txt, " ")

For i = 0 To UBound(txtarray)
    Select Case txtarray(i)
    Case "00000000"
        asctxt = "(NUL)"
        asctxt = "{"
    Case "01111101"
        asctxt = "}"
    Case "01111100"
        asctxt = "/"
    Case "01111110"
        asctxt = "~"
    Case "01111111"
        asctxt = "D"
    Case Else
        asctxt = " (ERR)"
    End Select
    
    endtext = endtext & asctxt
Next
Text1.Text = endtext
End Sub
 



Edited by - SamuelDravis on 11/18/2003 9:30:04 AM

Find If Ascii Or Binary
Hi,

I am trying to read a file. but before reading it want to determine whether that file is ascii or binary file.

Binary Ascii Code
Hi there!
A few weeks ago I asked for your help and got it to develop the function below. The function is supposed to transform a string into binary ascii and add an eight 0 in front. Problem solved. The problem is that this didn't work with the device I'm trying to program, so after trying to fix other things I thought might cause the problem, I decided that maybe I should try to put the 0 at the end, instead of the front. Well... I tried some things, but I'm getting a messed up output in the end. So again I ask for help.
Thank you!



Code:

Private Function ASCIIBin(sString As String) As String

Dim iPos As Integer, iAsc As Integer, iTest As Integer, iPower As Integer

For iPos = 1 To Len(sString)
iAsc = Asc(Mid$(sString, iPos, 1))
For iPower = 7 To 0 Step -1
iTest = 2 ^ iPower
If iTest <= iAsc Then
ASCIIBin = ASCIIBin & "1"
iAsc = iAsc - iTest
Else
ASCIIBin = ASCIIBin & "0"
End If
Next iPower
iPower = 0
ASCIIBin = ASCIIBin ' & " "
Next iPos

End Function

Convert .wav To ASCII
Hi,
I would like to convert a file in wav format into txt format, so to obtain a vector of numbers to create a graphic, with a program, like excel, that is not Matlab.
Exactly I've an algorithm in Visual Basic that analyses a vector of points (graphic) and then gives me in output a series of parameters.
In matlab this is easy, because it recognizes wav files but if I would like to do the same thing in Ms Access, I've to convert before, the wav file in txt file so that my algorithm in Visual Basic can analyse it.
Anyone knows if there exist some algorithm or code that convert wav files in ASCII text files?
Thanks
Bernd

Convert Ascii To Hex
ok i know to convert hex to ascii is simply Val("&h" & hexvalue), but how do you convert ascii to hex? using somthing simple like that (if existant), maybe i just need sleep to realize how to do it but right now i cant think of how to do it. help!!!

Convert *.Wav To ASCII
Is there a way to convert a *.wav file to a ASCII text that contains the sound in a numerical way. I also want to know the otherway around (converting ASCII to *.wav)
I f there's anybody who has a idee please let me know

Thanks

Christian

Convert CSV To ASCII
I am trying to take a CSV file and convert it to ASCII. Any suggestions?

How To Determine Whether File Is Ascii Or Binary
Hi there
Any idea how to make a VB program able to determine from a filename whether the file is ascii or binary?

Converting A Binary File To Ascii
I am creating a tool in VB to search HTML and PDF files and for selected strings. Comparing strings in the HTML file was ok as HTML is an ascii file and I only had to implement some code to remove the tags.

The problem I am having is comparing strings in the PDF file as they are binary files. Is there a way of using VB to convert the file nto ascii prior to comparing the strings?

I hope that makes sense.

Thanks

Saving Files ASCII Or BINARY??
Hello to All i want to save the Actual TExt files in less space with out compressing them for retriving the data more fast. any one please advise me regarding these techniques and any links if any of you know....

Thanks
Sreekanth Doppalapudi
sreekanthd@onebox.com

Ebcdic Ascii Hex Dec Oct Chr Binary Unicode
Recently, I am very interest in understanding more about these different formats:

ebcdic
ascii
hex
dec
oct
chr
Binary
Unicode

-Are there more?
-The ones that I have listed, what use do they have and when would you use it? I know some of them already.
-Why would you convert from one format to another?

I found this but really want to understand the correlations:
http://www.lookuptables.com/ebcdic_scancodes.php

I learned EBCDIC about 10 years ago but can't remember the purpose it serves for today.

Thank You

Determine If A File Is Binary Or ASCII
Is there any easy way to determine if a file is binary or ASCII?

Conversion From Ascii To Binary Format
hello ,

is there any direct function of converting ascii values to binary format.

thanks
nice day
jyothi

Convert Char To ASCII
I was wondering if there was a way to check that the first character in a string is a letter vs. a number.
Example: "123M" vs. "M123"
I was thinking of taking the first charcter, changing it to its ASCII value and comparing it with ASCII value of letters vs. numbers to figure it out that way..
Is there some feature in VB 6.0 that i can use to see whether the character is a letter or number? (Zero is included in the numbers.)

Thanks!!

Convert 5 Lines Of Hex To ASCII
OK, I have been reading up on ASCII but still can not get this right.
My app reads from a device on com port that sends 5 lines of ASCII code
Example

Quote:




49 02 01 00 00 00 31
49 02 02 47 36 4B 44
49 02 03 35 34 59 58
49 02 04 32 55 31 33
49 02 05 34 38 33 32

>





Which I need decoded to

Quote:




1g6kd54yx2u134832






The documentation I have found says this

Quote:




Returns 5 lines, A is line ordering flag, B-E ASCII coded VIN Digits





So I guess the 49 02 of each line is to be ignored?
and the rest needs to be converted?

Below is a screen shot of the message I received today

Convert A Word To Ascii
Hi peeps i was wondering if anyone can help me with this problem.

i am making a program to convert words to ascii and then display the ascii in a textbox

i can make it convert 1 letter of the word only. is there anyway to make it convert the whole word into ascii

thx

Convert Characters To Ascii No.
i have an array called chars(). when my program runs, 1 character is stored in each variable of the array eg. chars (0) stores 1 character, chars(1) stores 1 character and so on. i heard that there are 256 ascii characters, is there a simple and fast way to convert each character into its ascii number, say chars(0) had the letter u stored in it and the number of u was 132 then chars(0) would be changed to 132
thanks

How To Convert It To ASCII File
I download a log file from SUN server,if i open it with notpad,it looks like: ???? % @#w./.....; it's a binary file , my custumer can't read it unless it is a ASCII file.so i want to know how to convert it to ASCII file readable with .TXT or .XLS


maybe I should use following :
open "d:log001" For Binary As 1
...
...
Get .....
...
Close 1
Open "d:
esult.txt" For Random As 1
.....
Put ...

but it's difficult to know the rule of binary file,
any advice is very useful to me!thanks

Convert String To ASCII
How would I go about converting a string into and ASCII string. Just for an example, say I had the string apple (the ascii characters arent right)

Apple
a=4 p=7 p=7 l=2 e=1
Then the ascii string would be 47721

Anyone?

Thanks

Convert KeyCode To Ascii
How can I convert KeyCode and Shift to ascii under the KeyDown event?

I understand that not all the keys even convert, but I would like to be able to get lower and upper case letters, numbers, backspace, and enter.

I cannot use the keypress event.

Thanks!

Convert Ascii To Text
i can convert text to ascii using asc(), but how do i reverse it?

Convert Hex? Decimal? Ascii??
**



Edited by - Marce22 on 6/1/2005 11:23:36 AM

Convert Ascii String To Hex
Hi. I am having a problem finding the syntax to convert a 2 charactor String to a Hex value. The String will always be 2 charactors in length and will have ascii values from 00 to FF. Once in Hex, I will be using the value to set the .Height value of a Shape (Rectangle) which will represent the signal strength of a radio receiver. The receiver reports the signal level as a 2 charactor String, 00 to FF. I have tried a few different things and var types but keep getting a Type Mismatch.

Dim Signal_Level_Rec_A As Variant

Private Sub RecAComm_OnComm()
    Select Case RecAComm.CommEvent
        ' Errors
      Case comEventBreak ' A Break was received.
      Case comEventFrame ' Framing Error
      Case comEventOverrun ' Data Lost.
      Case comEventRxOver ' Receive buffer overflow.
      Case comEventRxParity ' Parity Error.
      Case comEventTxFull ' Transmit buffer full.
      Case comEventDCB ' Unexpected error retrieving DCB]

   ' Events
      'Case comEvCD ' Change in the CD line.
      'Case comEvCTS ' Change in the CTS line.
      'Case comEvDSR ' Change in the DSR line.
      'Case comEvRing ' Change in the Ring Indicator.
      Case comEvReceive ' Received RThreshold # of chars.
        Do
            DoEvents
            Comm_Recd_Rec_A = Comm_Recd_Rec_A & RecAComm.Input
        Loop Until InStr(Comm_Recd_Rec_A, vbCrLf) 'wait to receive <CR><LF> from receiver
        'Loop Until Len(Comm_Recd_Rec_A) = 4
        temp = Len(Comm_Recd_Rec_A)
        Comm_Recd_Rec_A = Right(Comm_Recd_Rec_A, temp - 1) 'strip off leading char.
        Comm_Recd_Rec_A = Left(Comm_Recd_Rec_A, temp - 3) 'strip off trailing CF,LF
         
        Rec_A_Meter_Comm_Rec.Caption = Comm_Recd_Rec_A
        If Left(Comm_Recd_Rec_A, 2) = "G0" Then 'status data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "G2" Then 'comm protovol version data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "GE" Then 'destination country data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "H9" Then 'scan status data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "I1" Then 'S-meter data follows 'This Case for Signal Level
            Signal_Level_Rec_A = Right(Comm_Recd_Rec_A, 2)
            Call Rec_A_Signal_Meter
        ElseIf Left(Comm_Recd_Rec_A, 2) = "I2" Then 'Center meter data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "I3" Then 'DTMF data follows
            DoEvents
        ElseIf Left(Comm_Recd_Rec_A, 2) = "NE" Then 'bandscope buffer data follows
            DoEvents
        End If '* add busy status I0/
             
      'Case comEvSend 'There are SThreshold number of characters in the transmit buffer
                      
      'Case comEvEOF ' An EOF charater was found in the input stream
                      
    End Select
    Comm_Recd_Rec_A = "" 'clear buffer
End Sub

Private Sub Rec_A_Signal_Meter() 'bargraph for Signal strength
    Dim temp As Byte
    temp = Signal_Level_Rec_A 'Trouble is here
    Rec_A_Meter_Signal_Level_Shape.Height = temp '* 3 'Signal_Level_Rec_A
    Rec_A_Meter_Signal_Level_Shape.Top = 1380 - Rec_A_Meter_Signal_Level_Shape.Height
End Sub '^ this number sets bottom position of bargraph


 

How To Convert Ascii To Hex Code?
How to convert Hex code to ASCII code and convert
ASCII code to HEX code by VB code?
how to analyse the hex code bit by bit?

On Converting An ASCII String To Binary Digits
I'm trying to find out first of all if this has been done before and if i'm waisting my time by doing it again, and if not how best to go about doing it.

What I'm trying to do is make a simple form one button one text box (or rich text box) and one label. input text into text box hit button and text in box is converted into it's binary equivelant. not converting numbers into binary but the binary representation of its ASCII code (N=01001110, n=01101110, etc.) any help would be appreciated.

Read Hex/Binary String From Database As Ascii
Hello Everyone,

I'm connecting to a Microsoft SQL Database. One of the fields I need to read is a column of type "Binary" in SQL Server. Here, for instance, is a trace of an INSERT to this database.

INSERT INTO...... TABLE ... "CFG01",@P2 .... @P2 varbinary(100) ..... 0x593230303730343138303031202020204C02004E3C00592020202020202020202020 2020202020202020202020202020202020202020202020202020202020202020202020 20202020202020202020202020202020202020202020202020202020202020

(Relevant Parts Included)...

And what that 'Says' in ASCII is "Y20070418001................."
Y=59
2=32
0=30
0=30
7=37
0=30
4=34
1=31
8=38
0=30
0=30
1=31
....

So... Anyone know how to 'Read' That string into ASCII Characters? When I do a simple "SELECT CFG01 FROM TABLE", I get, in VB a string that looks like this...
"????????<?"... Not exactly what I need.

ANY Help greatly appreciated!

THANK YOU
Ben

Reading Binary File Created In C (AScii)
Heyas,

I am racking my brain over this and hopefully some kind soul can put me out of my misery.

I have a binary file which stores data so:

typedef
{
char key[7];
char desc[20];
short supp_code;
long free_stock;
short min_stock;
char date[7];
float price;
}RECORD DATA;

Now whatever I do I cannot read this from VB without an error somewhere.

The closest I get is

Public Type StockRecord
key As String * 6
NC1 As String * 1
desc As String * 19
NC2 As String * 1
supp_code As Byte 'short
NB1 As Byte
free_stock As Integer 'long
NB2 As Byte
NB3 As Byte
minstock As Byte 'short
NB4 As Byte
YY As String * 2
MM As String * 2
DD As String * 2
NC4 As String * 1
price As Single 'float
End Type


I trust I am being very stupid somewhere - but bear with me.

Where NC stores Null chars and NB stores what seem to be bytes in the file that are not compatible with ASCII wheres as ofcourse in VB we work in UNI.

C Strings are ofcourse NULL terminated hence after each string I am reading the null and this is simply not used.

The above will give me everything except the minstock goes wrong for some records and right for others. Obviously Im doing something wrong with reading and discarding individual bytes and am probably barking up the wrong tree completely.

Can someone please either tell me the correct way to read a C data type short or correct my VB UDT / advise how I should be doing this?

Man thanks for any help

CandyMan

Reading Binary File Created In C (AScii)
Heyas,

I am racking my brain over this and hopefully some kind soul can put me out of my misery.

I have a binary file which uses a structure:

typedef
{

What Is The Best Way To Transfer (ascii && Binary) Data Between Two Processes?
I need to transfer string data - both ascii and binary - between to processes. i'm thinking about using the windows message system (PostMessage ....), but unsure whether this could handle binary data and what the maximum string length is.

are there any other possibilities like using something activex related?

Thanks for your advice!
Felix

Detecting File Type? ASCII Or Binary?
Hi All,

I am trying to create an application with VB6 that can detect file type while recursing a folder structure and if it is an ASCII file, strip the ctrl-M's from the file for inclusion in a Windows environment created package for installation on a UNIX environment.

We have a NT script running now that goes through a large list of file extensions and for each one runs the DOS2UNIX utility to strip the Windows type line endings (ctrl-M's), but I want ot make it more efficient by not having to know what extensions are needed and recursively go through each folder of a structure and detect what type of file is listed and run the stripping of ctrl-M's if it is an ASCII file.

Any ideas on the detection of file type?

Thank you in advance,
John

Find String In Files (ASCII And Binary)
Hello,

How can i search inside all the files available in the Disk like Windows Find Function works.

Copyright 2005-08 www.BigResource.com, All rights reserved