Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
More help
#1
Newbies always need help!


If i want to input a lot of data into a file, should i use many arrays or a double dimension array?

Also, if i have to input an array into a file, how do i?

Then, i need to read from the array and print whatever is required.

P.S. - I need the easiest and shortest way to do the above mentioned.

Thanx.
Reply
#2
Wrong forum. Post in the newbie forum next time.

>If i want to input a lot of data into a file, should i use many arrays or a double dimension array?

Depends. Are all the arrays of the same length and type? Tell me. Use double-dimension arrays if they are.

>Also, if i have to input an array into a file, how do i?

OPEN "bla.txt" FOR RANDOM AS #1
FOR i% = 1 to 50
PUT #1, , array1%(I%)
NEXT i%
CLOSE

This will write the (integer) array in quickly and efficiently but it won't be easily readable from a text file.

To get the array from the file:

OPEN "bla.txt" FOR RANDOM AS #1
FOR i% = 1 to 50
GET #1, , array1%(I%)
NEXT i%
CLOSE

>Then, i need to read from the array and print whatever is required.

FOR i% = 1 to 50
PRINT array1%(I%)
NEXT i%
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)