RosettaCodeData/Task/Read-a-specific-line-from-a-file/QBasic/read-a-specific-line-from-a-file.basic
2023-07-01 13:44:08 -04:00

15 lines
357 B
Text

f = FREEFILE
OPEN "input.txt" FOR INPUT AS #f
lineapedida = 7
cont = 0
DO WHILE NOT EOF(f)
LINE INPUT #f, linea$
cont = cont + 1
IF cont = lineapedida THEN
IF linea$ = "" THEN PRINT "The 7th line is empty" ELSE PRINT linea$
EXIT DO
END IF
LOOP
IF cont < lineapedida THEN PRINT "There are only "; cont; " lines in the file"
CLOSE #1