Click to See Complete Forum and Search --> : Input sequential file


Drew
April 3rd, 2001, 12:42 AM
I have a sequential file to input the first two lines are this:
Data-types Quiz, 8
1, What data-type would you use for the population of Chicago?, LONG,LONG,lng,1

The first variable is a string for Data-types Quiz

The second variable is a Integer that makes a control array with 8
buttons.

The second line is a string that is shown on a label. I can input the
first line into the program and make the buttons with this code:

Input #intFileNum, strTestName, intNumberOfQuestions

and I make the buttons and show the question in the label with this code:

For intLoadQuestions = 1 To intNumberOfQuestions
Call MakeTheButtons(intLoadQuestions)
For intLoadFields = 1 To 6
Input #intFileNum, g_strQuestionsAndAnswers(intLoadFields, intLoadQuestions)
Next intLoadFields
g_strQuestionsAndAnswers(intLoadFields, intLoadQuestions) = "<Enter you answer>"
Next intLoadQuestions

Close #intFileNum


How do I input the answeres in the text file? I want to put them into
an array and and the three answers into a array and and compare them
to the answere I input into the text box. I can't change the text file.

shree
April 3rd, 2001, 08:13 AM
for intLoadQuestions = 1 to intNumberOfQuestions
dim strQnA as string
dim arrQnA
Call MakeTheButtons(intLoadQuestions)
' for intLoadFields = 1 to 6
' input #intFileNum, g_strQuestionsAndAnswers(intLoadFields, intLoadQuestions)
' next intLoadFields
' g_strQuestionsAndAnswers(intLoadFields, intLoadQuestions) = "<Enter you answer>"
'
Line input #intFileNum, strQnA
arrQnA=Split(strQnA,",")
'
'Now arrQnA(0) contains 1,
' arrQnA(1) contains your question
' and arrQnA(2) onwards hold the answers.
'You can do whatever you like with these. Display them and compare them using the regular methods.
next intLoadQuestions