So I'm just making sure this works with normal XP projects cause I'm using one that can do this
File.open(filenamehere,"wb"){|f|
f.write("Hello")
f.write("hi")
f.write("Test")
f.write("bye")
}
File.open(filenamehere,"rb"){|f|
hello=f.read(5)
hi=f.read(2)
test= f.read(4)
bye=f.read(3)
}
Would that work?
It would be easier to simply write each word on a line, and read them into an array. Very rarely will you ever be using the seek functions for grabbing only a certain number of bytes when dealing with text.
file = File.open('text.txt', 'wb')
file.write("Hello\nhi\nTest\nbye") # \n is a newline symbol (must use double quotes, not single)
file.close
array = IO.readlines('test.txt')
p array
--> ['Hello', 'hi', 'Test', 'bye']
Could you possible teach me arrays, I have no idea how to use em.... I think i've got it right, but I'm just making sure.
p array
--> ['array1', 'array2', 'array3', 'array4']
but how do I use them in the array?
array[0] == 'Hello'
array[1] == 'hi'
array[2] == 'Test'
array[3] == 'bye'