Qbasicnews.com
November 27, 2021, 06:19:55 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: More help  (Read 2052 times)
surojit
New Member

Posts: 8


« on: September 06, 2003, 04:04:08 PM »

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.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: September 06, 2003, 04:10:10 PM »

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%
Logged

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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!