f(read|write) have next syntax: f(read|write)(void *data, size_t size, size_t nmemb, FILE *stream) Each time I used them I wondered what's nmemb for. It's much faster to write size bytes of data once then (size/nmemb) nmemb times. This way I thought until I had to deal with (fifo|pipe)s. You can (read|write) only one byte in one time, so if you want to (read|write) n bytes in one time you have to call f(read|write)(data, 1, 1, stream) n times[even if you call f(read|write)(data, n, 1, stream) you won't (read|write) n bytes]. Then I understood that it's much easier to call f(read|write)(data, 1, n, stream) to (read|write) n bytes in one time. Time is expensive, even if it's not yours but machine's! Save your moneytime!
Tuesday, January 8, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment