I'm a beginner in C and I need a function or implementation that returns a random line from a file .
I'm a beginner in C and I need a function or implementation that returns a random line from a file .
Read the entire file into an array of strings, then shuffle the array:
SourceForge.net: Randomizing an array - cpwiki
Finally, use rand() to pick a line from the shuffled array.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge