The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Reading a file in reverse order --- How?
Replies: 3   Last Post: Apr 11, 2013 4:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 7
Registered: 4/11/13
Re: Reading a file in reverse order --- How?
Posted: Apr 11, 2013 4:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

One possibility is to keep track of the stream positions for each entry when writing out and then SetStreamPosition to those positions in reverse order when reading each record back in. You ought to have enough memory for a 10K integer array. Argh! I can't seem to get Mathematica to put out a nice text for pasting. Will MathML work? Anyway, hopefully you can make some sense of this. It's not that big a change from your original code.

n=3;(*In general,n could be very large*)For[k=1,k<=n,k++,(*Create list on each pass through this loop...*)POt={{k,k+1},{k+2,k+3}};
Print[POt];(*Save list to a file*)Write[strm,POt];];
(*Other processing performed...*)
(*Open file with lists*)
(*Process,sequentially,each list that was saved*)

Print[PIn];(*Process PIn...*)];


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.