if i have an array like this
2,2,2
3,5,3
4,4,4
inside a file, how would i write to the file and replace the 5 with a 6?
ive tried everything with the open for output as #1bla bla bla
write #1, yada yada
but i just rewrites the file and i cant replace anything
2d arrays
You can use binary and write data to only the position you want.mar_angry wrote:what i want it to do is edit a 40x40 array so i can just change the number in the array, not have to rewritw the entire thing every time
Code: Select all
open xx for binary as #f
put #f, offset, data
I have left this dump.
Yes you could use a binary/random access file, but this is much more tricky, and you seem to be having trouble with the sequential files.
1600 numbers are nothing to a computer and your numbers are short integers as well.
Short answer is don't be afraid of over-taxing your computer. You are, I presume, going to have to read in the array anyway to do what ever it is you want to do with a 40x40 matrix.
Maybe you would be better using a text editor rather than qbasic for this problem.
1600 numbers are nothing to a computer and your numbers are short integers as well.
Short answer is don't be afraid of over-taxing your computer. You are, I presume, going to have to read in the array anyway to do what ever it is you want to do with a 40x40 matrix.
Maybe you would be better using a text editor rather than qbasic for this problem.