Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Read and write in a text file

Moderators: larsivi kris

Posted: 05/16/09 19:02:57


How to read a text file without knowing the encoding? (UTF-8, ANSI, Unicode, Big endian Unicode)

And also, how to write a file with a specific encoding? (in the Unicode case, including the BOM)


Author Message

Posted: 06/11/09 16:44:04


For reading and writing Unicode files, you can use the UnicodeFile? class. E.g.

	UnicodeFile!(dchar) f = UnicodeFile!(dchar)("C:\\Temp\\test.utf", Encoding.Unknown);
	dchar[] all =;