July 14, 2004 Another lib idea: text file I/O | ||||
---|---|---|---|---|
| ||||
It would be good to have some classes for reading/writing text files. My thought is that it would:
- auto-detect UTF-8, UTF-16 or UTF-32, first by checking for a BOM and then heuristically
- be able to write out a file in any of these formats on request
- use dchars to communicate text with the class user
- automatically understand PC, Unix and Mac line breaks and be able to write out any of these kinds on request (obviously defaulting to the native format); possibly be able to tell the class user which kind an input file is using
- support ANSI/Windows, IBM/DOS and possibly other encodings on request; ideally enable the programmer to specify a custom encoding (at least in the single-byte case)
- include a version of writef and writefln
- make it simple to read/write a whole text file from/to a dchar[] at once, as well as providing stream functions.
Any takers? Or anyone already working on such a thing?
Stewart.
--
My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
|
July 14, 2004 Re: Another lib idea: text file I/O | ||||
---|---|---|---|---|
| ||||
Posted in reply to Stewart Gordon | In article <cd3nkt$2e2e$1@digitaldaemon.com>, Stewart Gordon says... > >It would be good to have some classes for reading/writing text files. My thought is that it would: > >- auto-detect UTF-8, UTF-16 or UTF-32, first by checking for a BOM and then heuristically > >- be able to write out a file in any of these formats on request > >- use dchars to communicate text with the class user > >- automatically understand PC, Unix and Mac line breaks and be able to write out any of these kinds on request (obviously defaulting to the native format); possibly be able to tell the class user which kind an input file is using > >- support ANSI/Windows, IBM/DOS and possibly other encodings on request; ideally enable the programmer to specify a custom encoding (at least in the single-byte case) > >- include a version of writef and writefln > >- make it simple to read/write a whole text file from/to a dchar[] at once, as well as providing stream functions. > >Any takers? Or anyone already working on such a thing? > >Stewart. > >-- >My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit. This would be awesome, i'm totally ignorant on the subject though so can't help , but would defintly use it! Charlie |
Copyright © 1999-2021 by the D Language Foundation