Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Open file first
- iFile := FSOpenFile( sFile, false );
- //Reset some vars
- iQuestions := 0;
- bCanStartGame := false;
- //File empty
- if FSGetLinesCount( iFile ) < 0 then exit;
- //Read Q and A.
- for iNr := 0 to FSGetLinesCount( iFile ) - 1 do
- begin
- sContent := FSReadLine ( iFile, iNr );
- //Reset table before
- TQuestions[iNr] := '';
- TAnswers[iNr] := '';
- //Copy contents
- TContent := Split ( sContent, '*' );
- //Save Q & A
- TQuestions[iNr] := TContent[0];
- TAnswers[iNr] := TContent[1];
- //Increment questions
- iQuestions := iQuestions + 1;
- Log ( IntToStr ( iQuestions ) );
- end;
- //Check
- if iQuestions > 1 then
- begin
- sFileName := sFile;
- bCanStartGame := true;
- end;
- //Notify
- Log ( '[TRIVIA] Loaded a total of ' + IntToStr ( iQuestions ) + ' questions and answers!' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement