View Single Post
Old Feb 9th, 2007, 1:50 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
.exe files and .x files are binary files. They are not organized into text lines with a newline character. As a matter of fact, they are not organized into lines, at all. Any binary value of 10 which happens to be part of the data will give you a "line" count.

Confine your line counting to files which have lines and count bytes (total length) for the others. For total length, check out 'stat' and friends. You don't even have to open the file. For line counts, why don't you just read lines (let the library function look for newlines) and be done with it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote