Reading a part of text file.
Reading a part of text file.
I have a txt file and there is 50 lines and in each line has 50 ascii marks.
How i can read ascii marks on area that is lines 20-30 and rows 10-15?
Hope you get what i mean.
How i can read ascii marks on area that is lines 20-30 and rows 10-15?
Hope you get what i mean.
- {Nathan}
- Veteran
- Posts: 1169
- Joined: Thu Aug 19, 2004 6:08 pm
- Location: The wetlands of central Ohio, USA
- Contact:
Hmm... you can't with QB but I do know how you can. If you know maps with rpgs darkdread style then this will be very easy for you. Follow the steps and there you go.
1. In between every character, put a comma (I don't know any faster way, sorry)
2. DIMension the array (1 TO 50, 1 TO 50)
3. Load the file into the array the same way you would a map.
Now your file is in the computers ram.
4. Read it the same way you would a map.
That will give you the charectars you want. I would reccoment putting them in a new array if you are using them more than once. Otherwise, this will do if you are doing something really simple (like printing it to a screen)
1. In between every character, put a comma (I don't know any faster way, sorry)
2. DIMension the array (1 TO 50, 1 TO 50)
3. Load the file into the array the same way you would a map.
Code: Select all
FOR y = 1 to 50
FOR x = 1 to 50
INPUT Array(X, Y)
NEXT
NEXT
4. Read it the same way you would a map.
Code: Select all
FOR Y = 20 TO 30
FOR X = 10 TO 15
Array(X, Y) = ....
NEXT
NEXT
Sure you can with QB. If it's an ASCII file, all you need to know how to do is:
1. Keep track of line numbers (hint: use variables)
2. Know how to use MID$
3. Know how to use LINE INPUT
4. Knowledge of fixed-length strings might help if all the lines are of the same size, otherwise, just knowing how to work with strings is all you need
It's quite elementary, really.
1. Keep track of line numbers (hint: use variables)
2. Know how to use MID$
3. Know how to use LINE INPUT
4. Knowledge of fixed-length strings might help if all the lines are of the same size, otherwise, just knowing how to work with strings is all you need
It's quite elementary, really.
- {Nathan}
- Veteran
- Posts: 1169
- Joined: Thu Aug 19, 2004 6:08 pm
- Location: The wetlands of central Ohio, USA
- Contact:
... leave me alone! *calls 911* Hello, operater, I am being harrassed by some guy...
Hey, it is still fun to confuse people. Plus, I don't see many tutors by you. And I'am only 11, so give me a freakin brake already *runs of crying and goes start playing Grand Theft Auto: San Andreas*
Give me a break!!!
Hey, it is still fun to confuse people. Plus, I don't see many tutors by you. And I'am only 11, so give me a freakin brake already *runs of crying and goes start playing Grand Theft Auto: San Andreas*
Give me a break!!!