
28 Nov
2005
28 Nov
'05
6:41 p.m.
Quoting Mike Hearn <mike@...869...>:
Are there any good examples of reading a file into a string in the code? I've searched a little bit, but every thing looks more complicated than I would expect. How _should_ it be done?
You can use stat and mmap. Stat to find out the size of the file, mmap to load it, then just stick a \0 on the end and there you have your string.
*cough*
mike, you know that's not portable to Windows, right?
-mental