how to write a recursive function to read and print all the data from a file

Recommended Answers

All 5 Replies

That's a statement, what's your question? What have you done so far?

Allow me to ask the obvious question, why would you want to recursively read a file?

Indeed, what deceptikon asks, or do you mean "read the file from back to front"?

Perhaps the OP means recursivly traversing directories?

Unless it's for the exercise, I prefer a while loop over a recursive function and avoid a possible stack overflow.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.