how to find the no. of characters which are in a file in c program

Recommended Answers

All 2 Replies

call fstat() or _fstat() depending on os and compiler.

>how to find the no. of characters which are in a file in c program
Open the file and count them. Though I suspect you're asking the wrong question. Most of the time this question comes up when somebody wants to allocate a buffer large enough to hold the entire file, which is usually a poor solution in the first place.

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.