The program is changing the loop variable I to a value less than CLE+1, since RND yield a value between 0 and 1. Since the loop condition is never reached, the loop does not terminate.
You can't specify which line to input from a sequential file, you have to input all lines sequentially.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much, so how could i can i change it so that it pick up a number between 1 to 16 and then pas it to my input statement so that it read that specific number record.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, but I'm not sure I understand what you're trying to achieve here, in particular with the FOR loop and the random number, and where in all this reading files comes in.
However, if you want to read specific records by numbers, you should work with random-access files. The tutorial by Steve Estvanik at http://www.o-bizz.de/qbtuts/gw-train/#6 has a good introduction on how to work with them.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi ! this is little project to keep my mind up to speed.
I have a sequential file wich have 16 records. Each record has 6 characters.
I want to select the record randomly then write them in a random file.
After that, i will choose randomly one character from the string and display it.
I hope this clarify my request.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK, well in the above code I would start by making sure the loop variable is not being changed by the code in the loop, i.e. if you're going to use I for your record number your loop would have to run over another variable, maybe K. Hope that helps. Do check out the tutorial on random and sequential files as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I do not understand why in the following short For Next program after 16, the program goes on and on and on. Any indicator would be appreciated:
10 CLE = 15
20 FOR I = 1 TO CLE +1
30 I =INT(RND*CLE)
40 PRINT I
50 NEXT
In addition, is it possible to specify the line i want to input from a sequential file
Thank you
Richard
The program is changing the loop variable
I
to a value less thanCLE+1
, sinceRND
yield a value between 0 and 1. Since the loop condition is never reached, the loop does not terminate.You can't specify which line to input from a sequential file, you have to input all lines sequentially.
Thank you very much, so how could i can i change it so that it pick up a number between 1 to 16 and then pas it to my input statement so that it read that specific number record.
Richard
Sorry, but I'm not sure I understand what you're trying to achieve here, in particular with the
FOR
loop and the random number, and where in all this reading files comes in.However, if you want to read specific records by numbers, you should work with random-access files. The tutorial by Steve Estvanik at http://www.o-bizz.de/qbtuts/gw-train/#6 has a good introduction on how to work with them.
Hi ! this is little project to keep my mind up to speed.
I have a sequential file wich have 16 records. Each record has 6 characters.
I want to select the record randomly then write them in a random file.
After that, i will choose randomly one character from the string and display it.
I hope this clarify my request.
Richard
OK, well in the above code I would start by making sure the loop variable is not being changed by the code in the loop, i.e. if you're going to use
I
for your record number your loop would have to run over another variable, maybeK
. Hope that helps. Do check out the tutorial on random and sequential files as well.