Re: close(writefile)
- Posted by useless_ Dec 22, 2012
- 1082 views
Or a hash of the filename is the integer handle.
I feel this would be too much trouble - what happens if two different filenames end up with the same hash? At the very least, I'd want to see a working implementation.
If they hash to the same id and that id has been used before in the same program, add a lil something to the id from the random number generator until it's not the same any more. Some people are fans of hashes, i am not. It's an idea. In what i am doing, where an app may run thru millions of files, i don't know how where the pitfalls in hashes will be, or how to not fall into them. That said, i think if i recall a hashed handle, praps Eu can open that same file again. It may be a solution searching for a problem. It's not something i will write code for myself, i'll just keep doing what i am currently doing, because it works for me. Your mileage may vary.
useless