RosettaCodeData/Task/Read-a-specific-line-from-a-file/QBasic/read-a-specific-line-from-a-file.basic

16 lines
357 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
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