scanf for Common::File
|Reported by:||salty-horse||Owned by:||fingolfin|
Attached is an implementation of scanf for the file
class. It is very basic, and may not meet everyone's
needs. It may also be unportable - Are there any C
standards being violated?
The reason for the implementation:
During my fiddlings with the Kingdom O' Magic I needed
to parse large text files. Some of the data in the
files was spread over several lines.
* Using readLine was a bit unreadable since there were
several instances where I called readLine over and over
just to skip lines.
* Reading the entire file into a string and using
sscanf was very slow since sscanf calls strlen() each
and every time. It's very noticable on large files.
Using the new scanf greatly improved the readability
and speed of my text-parsing code.
Ticket imported from: #1553631. Ticket imported from: patches/677.