Posted by marcotheu on 20:11:00 01-15-2002
Hi,
I'm trying to read ascii art files en L(PRINT) them in QBASIC. I wrote the code lines beneath here. But that doesn't work.
Somehow the MID$ skips the spaces. Now I'm thinking of reading the file in binary (FOR BINARY AS #x). It would be also a better because it will also read the carriages and spaces I believe.
Does somebody have some clues how to read a binary file and put the whole ascii art file in one textstring variable?
x = FREEFILE
OPEN "A:\m.txt" FOR INPUT AS #x
INPUT #x, a$
CLOSE #x
FOR i = 1 TO 10
Y = i * 14
z = Y - 13
b$ = MID$(a$, z, Y)
PRINT b$
NEXT i
END
This is how I read the ascii file now.I have deleted the carraiges manualy.
The ascii image is 14 char wide and 10 high.
___ /\__\ /::| | /:|:| | /:/|:|__|__ /:/|::::\__\ \/__/~~/:/ / /:/ / /:/ / /:/ / \/__/
This is how I want to read the ascii file.
___
/\__\
/::| |
/:|:| |
/:/|:|__|__
/:/ |::::\__\
\/__/~~/:/ /
/:/ /
/:/ /
/:/ /
\/__/ Ascii-art /FIGLET font chararter "M"
Thanks marco
Posted by marcotheu on 13:27:00 01-17-2002
OK,
This is was I made of it.
It works pretty well.
Marco
____________________________
CLS
x = FREEFILE
OPEN "A:\alien3.txt" FOR BINARY AS #x
b$ = SPACE$(LOF(x))
GET #x, , b$
FOR m = 1 TO LOF(x)
k% = ASC(MID$(b$, m, 1))
IF k% 13 THEN
e$ = CHR$(k%)
total$ = total$ + e$
END IF
NEXT
CLOSE #x
PRINT total$
_______________________________