cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
UNIX/Linux Programming
C - Function that returns a random line
C - Function that returns a random line from a file
Feb 15, 2010 at 11:13pm UTC
ghostdlr
(2)
I'm a beginner in C and I need a function or an idea of an implementation that returns a random line from a file .
Feb 16, 2010 at 9:40am UTC
kbw
(9488)
There isn't one.
You can generate a random number (with rand()) and you can read lines from an opened file (with getline()), but you'll have to put it together yourself.
EDIT: getline is a C++ standard library function. Do you mean C or C++?
Last edited on
Feb 16, 2010 at 9:41am UTC
Topic archived. No new replies allowed.