Click here to Skip to main content
15,909,440 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to calculate total line number of a text file Pin
CPallini11-Mar-09 3:04
mveCPallini11-Mar-09 3:04 
GeneralRe: How to calculate total line number of a text file Pin
Hamid_RT11-Mar-09 3:20
Hamid_RT11-Mar-09 3:20 
GeneralRe: How to calculate total line number of a text file Pin
CPallini11-Mar-09 3:40
mveCPallini11-Mar-09 3:40 
GeneralRe: How to calculate total line number of a text file Pin
Michael Schubert11-Mar-09 4:23
Michael Schubert11-Mar-09 4:23 
GeneralRe: How to calculate total line number of a text file Pin
Hamid_RT11-Mar-09 7:48
Hamid_RT11-Mar-09 7:48 
GeneralRe: How to calculate total line number of a text file Pin
CPallini11-Mar-09 8:16
mveCPallini11-Mar-09 8:16 
GeneralRe: How to calculate total line number of a text file Pin
Hamid_RT12-Mar-09 20:00
Hamid_RT12-Mar-09 20:00 
AnswerRe: How to calculate total line number of a text file Pin
David Crow11-Mar-09 3:17
David Crow11-Mar-09 3:17 
You could open the file and read each character to see if it is a newline. This is not very efficient because of disk I/O but it will handle very large files. You could also read the entire file into a buffer and then read through the buffer counting newline characters. This is more efficient because disk I/O is done once, but it will not handle very large files. There are also functions that will read lines from files (they know internally to read to the next newline) so you could just count how many times a line is read.

"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown

"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons


GeneralRe: How to calculate total line number of a text file Pin
Code-o-mat11-Mar-09 7:08
Code-o-mat11-Mar-09 7:08 
AnswerRe: How to calculate total line number of a text file Pin
Hamid_RT11-Mar-09 3:19
Hamid_RT11-Mar-09 3:19 
AnswerRe: How to calculate total line number of a text file Pin
Stuart Dootson11-Mar-09 4:12
professionalStuart Dootson11-Mar-09 4:12 
QuestionSDI-appliction Pin
susanne111-Mar-09 2:52
susanne111-Mar-09 2:52 
AnswerRe: SDI-appliction Pin
David Crow11-Mar-09 2:58
David Crow11-Mar-09 2:58 
GeneralRe: SDI-appliction Pin
susanne111-Mar-09 3:09
susanne111-Mar-09 3:09 
GeneralRe: SDI-appliction Pin
David Crow11-Mar-09 3:12
David Crow11-Mar-09 3:12 
GeneralRe: SDI-appliction Pin
susanne111-Mar-09 3:30
susanne111-Mar-09 3:30 
GeneralRe: SDI-appliction Pin
David Crow11-Mar-09 3:41
David Crow11-Mar-09 3:41 
AnswerRe: SDI-appliction Pin
SandipG 11-Mar-09 4:12
SandipG 11-Mar-09 4:12 
QuestionMy second time to design a website... Pin
JackPuppy11-Mar-09 2:15
JackPuppy11-Mar-09 2:15 
AnswerRe: My second time to design a website... Pin
Hamid_RT11-Mar-09 3:23
Hamid_RT11-Mar-09 3:23 
GeneralRe: My second time to design a website... Pin
JackPuppy11-Mar-09 3:35
JackPuppy11-Mar-09 3:35 
GeneralRe: My second time to design a website... Pin
Hamid_RT11-Mar-09 7:49
Hamid_RT11-Mar-09 7:49 
GeneralRe: My second time to design a website... Pin
JackPuppy11-Mar-09 18:13
JackPuppy11-Mar-09 18:13 
AnswerRe: My second time to design a website... Pin
Stuart Dootson11-Mar-09 3:54
professionalStuart Dootson11-Mar-09 3:54 
QuestionUnordered Map Pin
CyanCrey11-Mar-09 1:52
CyanCrey11-Mar-09 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.