Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Most efficient way to go through a file

$
0
0
I have an idea for a small program that will display random lines from a text file, a database and XML would be far too heavy for this project, however the file may be large. I want to read out a single line and display it but it has to be random. For now it doesn't matter how many times a quote was displayed but int he future I may add this so maybe SQLite would be good I am unsure and for simplicity a flat text file will work for now.

I am thinking loading the whole thing each time would be a bit bunch but if I want to move between quotes I need to read it all out into a list. Would that be best? Read the entire file to a list then randomly choose from the list or query the file each time?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>