Loading ...
Sorry, an error occurred while loading the content.

Re: [libertybasic] Re:

Expand Messages
  • Lorne Russell
    Well there was one line wrong Should read if numlines
    Message 1 of 16 , Jun 14, 2013
    • 0 Attachment
      Well there was one line wrong Should read

      if numlines<61 then .......

      Try this – grabs last 60 numbers
      --------------------------

      open "file.txt" for output as #outfile
      for x=1 to 100
      g$=str$(x)
      print #outfile, g$
      next x
      close #outfile

      dim lastlines$(60)
      numlines=0
      open "file.txt" for input as #infile

      [read]
      if eof(#infile)<0 then [alldone]
      line input #infile, g$
      numlines=numlines+1
      if numlines<61 then lastlines$(numlines)=g$ : goto [read]

      for x=2 to 60
      lastlines$(x-1)=lastlines$(x)
      next x
      lastlines$(60)=g$ : goto [read]

      [alldone]
      close #infile
      'do whatever you want now

      for x=1 to 60
      print lastlines$(x)
      next x

      end
      --------------

      Lorne Russell


      From: paradisejb
      Sent: Friday, June 14, 2013 3:01 PM
      To: libertybasic@yahoogroups.com
      Subject: [libertybasic] Re:




      --- In mailto:libertybasic%40yahoogroups.com, "Lorne Russell" <lorneokb@...> wrote:
      >
      > 'here's another way to get last 60 lines in file
      >
      > dim lastlines$(60)
      > numlines=0
      > open "file.txt" for input as #infile
      >
      > [read]
      > if eof(#infile)<0 then [alldone]
      > line input #infile, g$
      > numlines=numlines+1
      > if numlines<60 then lastlines$(numlines)=g$ : goto [read]
      >
      > for x=2 to 60
      > lastlines$(x-1)=lastlines$(x)
      > next x
      > lastlines$(60)=g$ : goto [read]
      >
      > [alldone]
      > close #infile
      > 'do whatever you want now
      >
      > Lorne Russell
      >
      This seems to extract the lines beginning at line 60 rather than the last 60 lines in the file.





      [Non-text portions of this message have been removed]
    • jurgen
      Still not working to take the last 60 tickets en remove the bonus number but thanks everyone.
      Message 2 of 16 , Jun 26, 2013
      • 0 Attachment
        Still not working to take the last 60 tickets en remove the bonus number but thanks everyone.
      • jurgen
        I mean example 1 is taking the last 60 tickets but didn t remove the bonus number.
        Message 3 of 16 , Jun 26, 2013
        • 0 Attachment
          I mean example 1 is taking the last 60 tickets but didn't remove the bonus number.
        • green8819
          Hello all, If you don t mind, please continue the series with a new title called tickets . Thanks.
          Message 4 of 16 , Jun 26, 2013
          • 0 Attachment
            Hello all,
            If you don't mind, please continue the series with a new title called "tickets".
            Thanks.


            --- In libertybasic@yahoogroups.com, "jurgen" <dovejurgen@...> wrote:
            >
            > I mean example 1 is taking the last 60 tickets but didn't remove the bonus number.
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.