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




Text To Ascii


I am new to vb and am looking for a text to ASCII
conversion program. I need to send ASCII characters
out the comm port and I have to send the start and end
transmission characters along with the data
thanks for any help




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Sorting Data From An ASCII Text String And Saving It As Text File
Hi,
I'd first like to copy paste a section of my ASCII text string over here and then ask the question.Given below is the ASCII text string:

RT 01 A_UNIT
DEV 01 A_UNIT

=ontrol Mode ON LOCAL STAT
Occupied YES OCC
CCN Chiller START CHIL_S_S
Alarm State Normal ALM
Active Demand Limit 100 % DEM_LIM
Override Modes in Effect YES MODE
=
=?
RT 01 CIRCA_AN
DEV 01 CIRCA_AN

=IRCUIT A ANALOG VALUES
Percent Total Capacity 100 % CAPA_T
Percent Available Cap. 100 % CAPA_A
Circuit Running Current 185 AMPS A_CURR
Discharge Gas Temp - A2 122.9 dF DISTMPA2
Saturated Condensing Tmp 97.5 dF TMP_SCTA
Saturated Suction Temp 41.5 dF TMP_SSTA
EXV % Open 43 % EXV_A
Variable Head Press Pct. 0 % VHPA
=
=?

Given above is a portion of my ASCII text string.I'd like to know how to sort out the data from this file and copy it in the same format as given above into a new Text File,using the delimiting characters like the white space and the "?".The "?" indicates the end of the file and the following ASCII text string after every "?" indicates the start of a new text file.

I'd be very very grateful to the person who'd give me the solution to this.Thanking you in anticipation.

How To Convert Ascii Text To Utf8 Text In Vb6
hi everyone.
i use mysql as a database in vb6 . utf8 is used in mysql but ascii is used in vb6 so that i wanna adapt these two ones.
how can i convert ascii to utf8.
i'm really jaded ! help me please.

Ascii To Text
i didnt want to clutter the board and since this question relates i just posted it here. ok well here is where im at. im trying to convert the ascii code back to text. here is how i have it set up.5 text boxes and 2 command boxes the first text box is where the user imputs their message the user presses command button number 1 and that converts text to ascii and posts the ascii in text box 2this is easy no problem now the third text box i call the shifter because it takes what ever number they imput in it and that shifts the ascii up or down that many times also no problem as of now now when the user presses command box number 2 it is suppose to take the shifter and shift the ascii code that many times over which it does and then it is suppose to convert the newly made shifted ascii code back to a new text. example user enters hi converts to ascii 104 05 then user enters +1 for the shift presses convert to text in text box 4 it says 105106 and the new word says "ij" because thats the shift. again my probelm is the changing 105106 to ij im gonna post my whole code so far everything works sept for the bottom



Private Sub Command1_Click()
Dim c
c = ""
If Len(Text1.Text) = 0 Then Exit Sub
For b = 1 To Len(Text1.Text)
c = c & Asc(Mid(Text1.Text, b))
Next

Text2.Text = c
End Sub

Private Sub Command2_Click()
If (Text1.Text) = "" Then
MsgBox "enter your message to be converted then press convert to ascii", , "woops"
Exit Sub
End If
d = ""
c = ""
For b = 1 To Len(Text1.Text)
If Text2.Text = "" Then
MsgBox "first enter a message to be converted then press convert to ascii"
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "enter a number value that you will use to shift the ascii", , "error"
Exit Sub
End If
c = c & Asc(Mid(Text1.Text, b)) + Text3.Text
Next
Text4.Text = c ' everything beyond this point doesnt work
For b = 1 To Chr$(Text4.Text)
d = d & Chr$(Mid(Text4.Text, b))
Next
Text5.Text = d
End Sub

Get Text Above ASCII
I have made an application which retrieves all entries in the Favorites folder. Using Windows 2000 SP4 and Microsoft Internet Explorer 6. One of the entries is:

Венгерский танец

But it is coming out

??????????? ??????

in my application using VB 6. I am trying to put this in a database but text ?????????? ?????? is no good. Any ideas how I can get the text correctly in the access database? Thanks.

Ascii To Text How ?
Hi guys , there's any way to convert Ascii to text ?

thanks for reply

Ascii Text
I would need a

control for displaying and editing ascii text like in edit.com or other console apps.

or if not then

code for converting between ascii text and some sort of text with escape characters representing those characters the textbox control doesn't display lik e vbnullchar and vbcrlf, vbtab and so on.

or if not then

a list of the characters that doesn't display in a textbox

Ascii Only In Text Box
Ok, I want to type letters and numbers on the key board and
have the ascii code come up in the text box, instead of text.
This is as close as I can get:
_______________________________________________
Private Sub Text1_KeyPress(KeyAscii As Integer)
Text1.Text = Text1.Text & KeyAscii
End Sub
________________________________________________
The "Text1.Text & KeyAscii" was just to get sequential characters in the text box.
Notice that:
mike becomes, ekim109105107101

Three problems:
1) If I type the word "mike", it comes out backwards(ascii included).
2) I only want ascii not letters and not in reverse order.
3) Things get worse when I try to use the "enter" key.

If you create a simple textbox and cut and past the above code, you will see exactly what I mean.

Thank's for any help!

Converting Text Into Ascii Text
ok, i have just started VB and i have evrything done on m project exept for one thing. Its a prog where u enter text into one text box, and when u press "translate" it comes up ans ascii text in another text box, what would that code be? i have been looking EVERYWHERE and hoping that this is the right place, PLEASE email me: EMAIL ME PLEASE!

Ascii Value Converted To Text
how do you make a Textbox show the value of an Ascii value? ... i want it to display a " (ascii 34)

it checks if it doesn't end with a " after the lost focus and then it places it there but i can't say Text1.text = Text1.text & """

i've had similar problems like this so please don't give me me alternatives

elbow deep within the boarder line. show me that you love me and that we belong together.

ASCII Text Header
Is this header a fixed or variable length header? Meaning:

Will byte 80 always have the value you want?
Take BITPIX for example. If 16 / 16 = 1 Then Len(BITPIX) = 1, but if 16 / 1 = 16 Then Len(BITPIX) = 2

Is NAXIS1 always going to be where you expect it? Or will it vary depending on the information in the header, much like the ID3 frames in an MP3 file?

What Are These Ascii Values As Text?
What is Asc(5)?
What is Asc(12)?

These codes are used as an end of transmission code with the data I am using and I need to know what they actually are.

Text -> ASCII Graphics
Hello,

I was looking around and found some useful progs for text->ascii gfx, i.e. from I to
Code:
---
|
|
---
etc., I was wondering how could I do this in vb, I mean how can I get the build/shape of a letter?

Thanks in advance!

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

Ascii Text Compression
Anyone know of a way of compressing a load of text, without the resulting 'data' containing any CR/LFs ?

The reason I ask is because I want to include a large amount of data in an app im making, (about 600K), and I dont want to put the data into a file.

So I wanted to hardcode the compressed the data into the app, and then have it decompress the data at runtime.

Any ideas ?

- jamie

Putting ASCII Characters Into A Text Box.
I'm working on a program that when I press a button, ASCII character 11 and the number 1 should enter the text box. But I don't know how to add the ASCII character.

Converting From Ascii To Plain Text
Hey.

I wanted to make a program that would translate for example 13 to a Return. But it doesn't seem possible.

Lets say i translate 3 enters into ascii = 131313 . Then how will i know i the chars where ment to be 131 3 13 or 1 32 32 3 ? Is it possible to create a converter that way, without using somekind of decimiter.

Text File Coversion From ASCII To UTF 8
Hi,

I am writing a program to create text files. I want to get the text file in UTF 8 format. Can anyone of you share the script how to auto covert the file format from ASCII to UTF8 when creating the text file.

When i try it out, it only conver to unicode. NOT UTF 8.

Thanks & Cheers

Blue_Thunder

Convert Text File To Ascii
Does anyone have some code out there that will convert a text file to an ascii file????

How To Tell If A File Is Ascii Text Format
Hello,
I am making a simple file viewing demo, which will display the contents of a text file in a multi-line textbox from a file selected in a directory listing. I only want to open the file if it is in "plain text" format - so files like .txt, HTML files, VB files like .frm, .vbp, and .cls would qualify but .frx would not; .exe, .xls. etc. would be excluded as well. (In the case where a non-text or binary file was selected, the multiline textbox would simply display "File is not in text format" or something to that effect.)

Without relying on the file extension, is there a way to test the file to say with reasonable certainty that it qualifies as a "plain text" file? I'd appreciate your thoughts ...

Reading ASCII Text Files
How do I open an ASCII text file and read it line-by line into string variables?

Sorry, I'm a programming virgin.

Thanks.

ASCII To ISCII Text Conversion
Hello Experts,

I am working on a project where name & address in english
must be converted to NUDI Kannada font text.
But in Nudi there is API to convert from ISCII to Nudi Bilingual format. Can any one tell me how to convert ascii to iscii text format.

ASCII -> Text And Visa Versa
Is there anyway that I can get VB to convert ASCII numbers to single character strings and back again? I need it for doing v. basic encryption of high scores.


Thanks

Ascii Text To Access Database
i need a code snippet to read an ASCII text file delineated by | (pipe sign) and transfer the data to an Access Database

The data i have, some are delineated by space, some by pipe sign i.e |

Reading From A Ascii Text File
Hello, i'm trying to read a ascii text file using the streamreader.
For simplicity, let's say my .txt file contains the following data:
a
b
c
d
e
f
g
How would i read from, let's say the first occurence of character "c" to "f"?
In pseudocode, i would be something like:
for starting charcter = "c" to 3

It would read 3 lines after "c", up to "f", and give me:
c
d
e
f

I would appreciate your help!

Unix Ascii Text Importing
I am trying to import an ascii text files that is created on a Unix machine. I was wondering if anyone knows how to deal with these file types. The problem that I am having is with the Unix text file because it only end with a carriage return and not with a carriage return and Line Feed. I have tried searching for the carriage return in the file chr(13) but it will not find it.

If anyone has had luck dealing with this in the past any help would be appreciated.

Thanks in advance

Sean Gearin
sgearin@modicon.com

Convert A Unicode Text File To ASCII
I'm trying to read a text file into visual basic, change a part of it, and write it back out a text file. I had been having problems using OPEN (always resulted in an error 36), even though I had tried using LOF and EOF.

I found that the problem was the text file that I am trying to read from is in Unicode. Is there an easy way to convert this text file into an ASCII text file before I read from it?

Ascii Character Set Functions In Text Boxes
Help!!

I am trying to edit some text in a text box by using the ascii codes for the editing functions i.e. chr(8) for delete etc, at the moment when i write the following:

textbox.text = textbox.text & chr(8)

instead of deleting the last character a black rectangle appears, which i guess means the the command is being written as its character rather than its function.

How can i get over this problem??

ps i also want to use the controls for tab, shift, shift lock and the other general keyboard function keys.

How To Make A Text Box Display Ascii Character
i have a text box that receives the ascii character's sent by a server but it only receives the first ascii character and the others are not displayed ..how to make it display the total ascii character sent by the server ???

Replace Text With Full ASCII Code?
does anyone have that code that will replace everything in data.txt with it's ASCII code? or a function that will do it? Something like this:

Private Function ASCII(data As String) As String
data = Replace(data, ">", "%3E")
data = Replace(data, "`", "%60")
data = Replace(data, "{", "%7B")
data = Replace(data, "|", "%7C")
data = Replace(data, "}", "%7D")
data = Replace(data, "~", "%7E")
data = Replace(data, ":", "%3A")
data = Replace(data, ";", "%3B")
data = Replace(data, "<", "%3C")
data = Replace(data, "=", "%3D")
data = Replace(data, Chr(34), "%22")
PostASCII = data
End Function

I dont think i can find all the ascii. does anyone have it done already?

Printing The Ascii Code Of A String Into A Text Box.
Hi all,

I need a code that will do as the title suggests, take a string, letter by letter, and print out the ascii code to a text box of each letter. I have not used Visual Basic for quite some time, and remember learning how to do this, but forgot how.

Thanks in advance.
Chris

Replacing Text In Open Ascii File
What is the comand to replace text in an open ascii file? Please help.

Records 1000K From Ascii Text File
Hi,

How to retrieve data from ascii text file which is having 1,000,000 lines or records and store data at a stretch directly in Oracle using Client to Server.

Captain

Limiting The Number Of A Particular Ascii Character In A Text Box?
Hello,

Can anyone tell me how I can limit the number of times that an Ascii character can occur in a text box?

Thanks, Bruce

Read Only Last Line Of Text/ascii File
Hi Guys,

I needed some help regarding file reading in VB 6. I am writing a program that needs to insert a record in a text file. The text file has following format..

Date, Time, Open Price, Close price

Now i need to insert record only if date is greater than last date in file.

So everytime I need to insert record, I have to open file and read sequentially and then I reach last record. This takes time.

IS there a way to read such file in binary or whatever so that i can get last record straight away or very quickly without going thru all records one by one.

If there is can anyone post a small code.

[Records in the (text) file is like -

01/01/2006, 1100, 123.33, 155.55
01/01/2006, 1130, 122.22, 134.33
01/01/2006, 1200, 112.22, 124.33
so on ... ]


Thanks a lot,

Cheers,
GR

Extended Ascii/unicode String Conversion To Stanard Ascii
I encountered problems when sending certain characters from Windows VB to IBM Mainframe Cobol/DB2 such as
‘(left single quote) or ’(right single quote). All the characters after the extended ascii got cut off. I don't have problems when sending '(single quote).

Is there any vb functions to convert it? Or maybe changing the  
XEOLEDB mapping below would fix it (sample code below)?

{L"DESCRIPTION4", NULL, 68,STANDARD_COL_FLAG, 56, DBTYPE_BSTR, 0,0,0},


I am not familiar with IBM Mainframe and the service connecting VB to it. My only solution right now is to use the replace function but I am afraid there will be a performance problem.

thanks
clark

Is There Any Wany To Save ASCII Text File Into UNICODE Text File Thru VB6?
Hi there,

I have a text file in ASCII and I want to save this text file as UNICODE text file thru VB6. Is this possible from VB6, if so, please help me how to do this?

thanks in advance.
regds.
Chandra

Printing To A DOTMATRIX Printer In ASCII Text Format
Hi,
OS : Windows 9X
Platform : Visual Studio 6, Environment : VB6
Printer : Epson Compatible 80 Col, 9 Pins

I want to send data to printer using VB Code without using Printer Object.
i have tried following tricks :
Ist Method :
1. Create a Text file containing text to print.
2. Send the text file to printer using Shell( ) Command.
Copy <TextFile> to <LPT1>

II Method similer to first.
/////////////////////////////////////////////////////
Private Sub PrintToPort(FName As String, Optional LPT As String = "LPT1")
Open FName For Input As #1
Open LPT For Output As #2
StrToPrint = ""
While Not EOF(1)
Line Input #1, StrToPrint
' StrToPrint = StrToPrint
Print #2, StrToPrint

Wend
Close #2
Close #1
End Sub
//////////////////////////////////////////////////




I know this is not proper method to print a file. Any alternate to do the job ?

Need Help Sending ASCII Characters (text :p ) As Keystrokes To A Game
Hmm it's been almost 24 hours and my original post only got 4 views and no reply on the API forum, soooo I decided to give you a link here (there's no point in copying the whole post, right?). The thread is this one:

http://www.vbforums.com/showthread.p...postid=1368801

Please, at least read a bit of it and if you have ANY idea, tell me! I need an easy way to convert ASCII characters to key codes (I don't wanna have to go through each one of the 256 characters and try to guess what is the corresponding key code)...

How Do I Find Out How Many Lines Of Text Exist In An ASCII Txt File?
How would I find out how many lines of text exist in a txt file?
Would this work?

Do While EOF(1) = False
datacount = datacount + 1
Loop
Close #1

but i tried this, but the loop just keeps going, and going, and going.......freaking energizer bunny...

Populate An Access Database From ASCII Text Files
I am writing a VB program (VB6) that creates an Access database with 8 tables, then populates the the tables from  8 corresponding ASCII text files.  I have successfully created the the empty mdb.  Now I need to populate it.  The fields in the ASCII files are not delimited in any way, and each field varies in length (from 2 to 80 characteres).  The number of fields in each of the 8 files varies also (from 13 to 25).  Is there a quick or easy way to populate the Access database from within the VB program?  Or do I have to do it brute force: field by field for each record for each table?  There can be tens of thousands of records in some of the tables, too, or as little as a few hundred.  Also, this program will be used repeatedly on different text files, so it is more than a one time effort.

Thanks,
Jim

Read A 3column Table From An ASCII Text To 2D Array
Dear Pals

There is a FAQ in this forum related to this issue,related to Visual Basic, but it doesnt adress my problem, because it reads data in one line as one text or one value. My problem is to read discrete data in one line as discrete values.

Consider this in a simple Notepad text file(ASCII)

1 2 3
4 5 6
7 8 9

ie 3 lines in 3 columns, there is 3 data per line.
How can I read each data separate from the other and say for example A(1)=1; A(2)=2; A(3)=3 etc

A simple line of code will do.


Column Aligning Text Ascii Output File
Code:
    For i = 0 To numMeas - 1 Step 1
      Print #FileNumber, measurement(i).name, measurement(i).hexID, measurement(i).lDecimalID, measurement(i).sDecimalID
    Next i


I am writing data to a text ascii file. This output file will be used as a report. I want the columns to be aligned correctly. Problem is, if the text in the first column is too long (over 13 chars) an extra tab is put in, which makes the data not align properly. Can anyone help me out, on the best way to format my output to text ascii file? vr, Xeifrank

Life is one big IF/ESLE statement

Best Control To Use To Display Contents Of An ASCII Text Appending File?
Hi,

I have a chemical analyser grinding out results for several process streams. As part of saving historical data, I format the results from each analysis into an ASCII string with timestamp, and then append the string to the appropriate sample file.

What is the easiest way to allow the user to scroll through such files?

For event logging, I have set up a series of text lables (15 say) and the used a vertical scroll bar to dispaly 15 of the last 200 events. The events are stored in a circular buffer, which contains the last 200 events. This works well, as I can color each line to indicate the type of event (yellow on red for error, white on green for result, white on blue for standard..). But the coding is fairly complex and am looking for a simple display of analytical results for a given sample stream.

In the case of the anlysis results, the data is appended, so the file just keeps growing. Presumably, monthly files will be separated and stored.

Hiding/deciphering Text Contents Of Ascii Files. Help Pleez!!
Hi,

I have an app in VB6 that generates "String & Numeric" data records during the generation phase, then it writes that data to an external file, for now as ascii. Then during the analysis phase the app reads that data back from the file for further analysis against other similar files. My question is: I do not want any one to be able to read/understand the contents of these data files. In other words, I need to make the contents of that file deciphered/scrambled/unreadable so that when someone opens the file in notepad, they would not be able to understand the contents at all. How can I do that?

The option of ( hiding the file deep in one of the subdir or changing its attribute or changing its extension as a camma-flash ) is not valid and will not work in this case.

I am looking for another elegant option that converts the data during the generation phase to some form of unreadable binary or other encoding scheme. Does anyone have any ideas?

Your help is greatly appreciated.

Foreverdba.

Detecting If Ascii Keys Are Pressed, Eg Ascii(31)
I need to be able to detect if someone presses a key like "1" by using ascii keys

so like detect if ascii(31) is pressed

i need this for 2morrow so help!

~

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

How Do I Export/save An Access Table As An Ascii Comma Delimited Text File
I need to export a table from an Access database into an ascii comma delimited text file using VB6. The function used in Access VBA is TransferText. Can anyone tell me how the heck you do the same thing using VB6. I have searched the MSDN help file from one end to the other but I am obviously not putting in the right question.

Any help would be greatly appreciated and would stop me going prematurely grey

Binary Files Are Just ASCII Text Files... Why?
I have very little dealings with reading/writing files using binary access. I've always used simple Input/Output as I've only had small tasks to do with files.

I have read many times that when you write out raw binary data to a file and open it up, it looks like a bunch of gibberish. I'm not seeing this.

Here is some sample code of what I'm doing

Code:
Dim x As Long
Dim b(1 To 1000000) As Byte
Dim ff As Long

ff = FreeFile
For x = 1 To 1000000
b(x) = Int(Rnd * 255)
Next

Open "c:inary.txt" For Binary As #ff
Put #1, 1, b
Close #ff
Again, just sample code... what I am really doing is writing my game map data to a file. I put it in a byte array just like b() is.

However, when I open this file up in my text editor, I see everything in ASCII characters.

What happened to the "gibberish" I am supposed to be seeing?

If I did this for example instead

Code:
b(x) = Int(Rnd * 26) + 65
I would see all capital letters when I viewed the file.

Subsequently I am reading the file into my byte array like this sample code

Code:
'Fill the temp array with the file contents
Open "c:inary.txt" For Binary As #ff
ReDim b(LOF(ff))
Get ff, , b
Close #ff

Am I missing something, or is what everyone calls "gibberish" just random ASCII characters they see?
I also write other files that contain mostly text (which I convert to byte arrays). These open as plain text files which are easily readable.

Any input of how I can write "bytes" to files that dont show up as ASCII when opened with a text editor?

Thanks

Data Conversion: EBCDIC-&gt;ASCII , ASCII-&gt;EBCDIC
Is there command to convert an EBCDIC string to ASCII and the other way around?

Tom Cannaerts
slisse@planetinternet.be

The best way to escape a problem, is to solve it.

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