PRINT ascii-art in QBASIC 
Author Message
 PRINT ascii-art in QBASIC

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.
      ___
     /\__\  
    /::|  |  
   /:|:|  |    
  /:/|:|__|__    
 /:/ |::::\__\  
 \/__/~~/:/  /  
       /:/  /
      /:/  /  
     /:/  /  
     \/__/  

Thanks marco



Sun, 04 Jul 2004 03:56:36 GMT  
 PRINT ascii-art in QBASIC
Hello. My name is marco. You killed my father. Prepare to die.

Quote:
> INPUT #x, a$

Try using Line Input instead.

--
http://www.geocities.com/steven_basic



Sun, 04 Jul 2004 04:21:30 GMT  
 PRINT ascii-art in QBASIC
Hi!

LINE INPUT works fine. However, here is a 'BINARY' version:

x = FREEFILE
OPEN "m.txt" FOR BINARY AS #x
b$ = SPACE$(LOF(x))
GET #x, , b$
CLOSE #x
FOR i% = 0 TO 10
    PRINT MID$(b$, i% * 14 + 1, 14)
NEXT

--
Thorsten Guenther
Mainz, Germany



Sun, 04 Jul 2004 07:52:27 GMT  
 PRINT ascii-art in QBASIC

Quote:

> LINE INPUT works fine. However, here is a 'BINARY' version:

> x = FREEFILE
> OPEN "m.txt" FOR BINARY AS #x
> b$ = SPACE$(LOF(x))
> GET #x, , b$
> CLOSE #x
> FOR i% = 0 TO 10
>     PRINT MID$(b$, i% * 14 + 1, 14)
> NEXT

Too slow!

--
Cellphone: 0038631752815

Don't feel bad about asking/telling me anything, I will always gladly
reply.

Digging for info? Try AI Meta Search:
Http://WWW.AIMetaSearch.Com

MesonAI -- If nobody else wants to do it, why shouldn't we?(TM)
Http://WWW.MesonAI.Com



Sun, 04 Jul 2004 23:52:36 GMT  
 PRINT ascii-art in QBASIC

Quote:

> > LINE INPUT works fine. However, here is a 'BINARY' version:

> > x = FREEFILE
> > OPEN "m.txt" FOR BINARY AS #x
> > b$ = SPACE$(LOF(x))
> > GET #x, , b$
> > CLOSE #x
> > FOR i% = 0 TO 10
> >     PRINT MID$(b$, i% * 14 + 1, 14)
> > NEXT

> Too slow!

> --
> Cellphone: 0038631752815

> Don't feel bad about asking/telling me anything, I will always gladly
> reply.

> Digging for info? Try AI Meta Search:
> Http://WWW.AIMetaSearch.Com

> MesonAI -- If nobody else wants to do it, why shouldn't we?(TM)
> Http://WWW.MesonAI.Com

OK Thorsten,

Thanks a lot. It helped me a lot. Here is what I made of it.
I implemented the code that when it reads a carriage it will be
skiped.
On screen(PRINT) it looks fine now but when I print it out (LPRINT) it
makes some errors. I

__________________________________________
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$
____________________________________



Mon, 05 Jul 2004 21:07:49 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Unicode Question, ASCII ART..

2. Where art thou' QBasic

3. qbasic - hex 2 ascii

4. Need help turning basica binary into qbasic ascii!!!

5. ASCII Codes in QBasic!!

6. QBASIC EBCDIC > ASCII Conversion Routine

7. QBASIC read in an ascii file

8. probs using print # garbled ascii rubish

9. Printing ASCII Characters (Line Draw)

10. Printed symbol/char and ASCII of of any Key

11. Printing in colums (ascii)

12. Printing to an ASCII

 

 
Powered by phpBB® Forum Software