Posts: 19
Threads: 3
Joined: May 2003
i have a 32 by 32 DATA statement in a seperate file. how could i open that file, read the data, put it on the screen and get it?
or would it be easier to just put the data in my program.
(soon the file will contain close to 30 of these 32x32 bitmaps as i make new tiles for my application.
if somebody cuts of your hand you still have two sharp bones to stick in thier eyes"
Posts: 6,419
Threads: 74
Joined: Mar 2002
It would be easier to put that in your command.
If you still want to use the file as external, remove the "DATA" statements and leave just the numbers:
Code:
4, 5, 6, 4, 3, ...
4, 3, 1, 2, ...
for example. Then you can read it using OPEN and the like:
Code:
f%=FREEFILE
OPEN "MyFile.txt" FOR INPUT AS #f%
FOR i%=1 TO 32
FOR j%=1 TO 32
INPUT #f%,c%
PSET (j%-1, i%-1), c%
NEXT j%,i%
CLOSE #f%
It would be better if you posted the file so we can see the format it has.
Posts: 19
Threads: 3
Joined: May 2003
hmm good good. i think you solved my problem
if somebody cuts of your hand you still have two sharp bones to stick in thier eyes"
Posts: 1,813
Threads: 284
Joined: Mar 2003
Or you could shorten the program a few characters...
Code:
f%=FREEFILE
OPEN "MyFile.txt" FOR INPUT AS #f%
FOR i%=0 TO 31
FOR j%=0 TO 31
INPUT #f%,c%
PSET (j%, i%), c%
NEXT j%,i%
CLOSE #f%
earn.