Page 1 of 1

Convert simple text into Unicode?

Posted: Thu Feb 19, 2004 12:59 am
by Guest
Hi
A quick question: How can I convert a simple Text from QBasic into Unicode and safe it in a file?

Thanks
FatalError

Re: Convert simple text into Unicode?

Posted: Thu Feb 19, 2004 2:35 am
by yacinator
if u mean to convert .txt format text to unicode (by that i  assume u mean uncoded text, on my computer unicode extonsion is TXT it might be diffrent on yours) then it's really simple.
u open the file for output and then u open a new file for
input and save it in there. u do it like this:

Code: Select all

OPEN "file1.TXT" FOR INPUT AS 1
INPUT#1,var$
CLOSE#1 
that opens the file and then this writes it to a new file:

Code: Select all

OPEN "file2.TXT" FOR OUTPUT AS 2
WRITE#2,var$
CLOSE#2
i think that should do the trick  ;)

Re: Convert simple text into Unicode?

Posted: Thu Feb 19, 2004 3:03 pm
by Guest
Yes, it runs!
But now I have a new problem:
Any Line in the file begins and ends with a >"<
What can I do against this?

Re: Convert simple text into Unicode?

Posted: Sat Feb 21, 2004 10:30 am
by yacinator
well u can't remove the >"<'s from the file but you can display the file withuout them. u do something like this

let var2$=mid$(var1$,3,varLEN) 'var1=file varLEN=last character of the file

;) &nbsp;

Here it is guys...

Posted: Sat Feb 21, 2004 10:59 am
by Dr_Davenstein

Code: Select all

CLS

A$ = "Dr_Davenstein Rules!"
FileNumber = FREEFILE

OPEN "Myfile.myf" FOR OUTPUT AS FileNumber
 PRINT #FileNumber, A$
CLOSE FileNumber



OPEN "Myfile.myf" FOR INPUT AS FileNumber
 INPUT #FileNumber, B$
CLOSE FileNumber

PRINT B$

KILL "MyFile.Myf"

...And here is a screenshot of my latest QB game,Pacenstein! It might take a second to download.
Image

http://www.QBNZ.com/dr_davenstein/Pacenstein.zip