digitalmars.D.learn - D doesn't read the first character of a file (reads everything but the
- Enjoys Math (7/7) Jul 17 2017 DMD32 D Compiler v2.074.1
- Nicholas Wilson (2/9) Jul 17 2017 I wonder if it thinks there is a BOM and eats it?
- Sebastien Alaiwan (4/11) Jul 18 2017 Could you please share the first 32-bytes (in hex) of your file?
- Steven Schveighoffer (10/22) Jul 19 2017 Looking at the implementation of readText, I believe its implementation
- bauss (8/31) Jul 19 2017 I'm feeling this. My keyboard sometimes messes up and will send
DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?
Jul 17 2017
On Tuesday, 18 July 2017 at 02:21:59 UTC, Enjoys Math wrote:DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?I wonder if it thinks there is a BOM and eats it?
Jul 17 2017
On Tuesday, 18 July 2017 at 02:21:59 UTC, Enjoys Math wrote:DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?Could you please share the first 32-bytes (in hex) of your file? Like: $ hexdump -C input.txt
Jul 18 2017
On 7/17/17 10:21 PM, Enjoys Math wrote:DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?Looking at the implementation of readText, I believe its implementation is not able to trim off the beginning of a file. Be wary of how you look at the result, some tools may "helpfully" hide things (like unprintable characters, or overwrite what has already been displayed when it sees a carriage return). If you can't figure it out yourself, the best thing to do here is to post your exact file somewhere so people can diagnose. Or reproduce with a smaller one, and then post that somewhere. -Steve
Jul 19 2017
On Wednesday, 19 July 2017 at 15:18:00 UTC, Steven Schveighoffer wrote:On 7/17/17 10:21 PM, Enjoys Math wrote:I'm feeling this. My keyboard sometimes messes up and will send invalid key presses to my OS which often ends up with invalid characters being written in files. When I encounter it I usually open Notepad++ and turn on show all characters which will display unprintable characters, simply allowing me to delete them and have a clean file again.DMD32 D Compiler v2.074.1 import std.file; void main() { string bigInput = readText("input.txt"); } The file is 7 MB of ascii text, don't know if that matters... Should I upgrade versions?Looking at the implementation of readText, I believe its implementation is not able to trim off the beginning of a file. Be wary of how you look at the result, some tools may "helpfully" hide things (like unprintable characters, or overwrite what has already been displayed when it sees a carriage return). If you can't figure it out yourself, the best thing to do here is to post your exact file somewhere so people can diagnose. Or reproduce with a smaller one, and then post that somewhere. -Steve
Jul 19 2017