Re: File I/O - rawWrite issues

2013-05-15 Thread 1100110
On 05/08/2013 07:29 PM, H. S. Teoh wrote: > > No need to be embarrassed; it happens to the best of us. IME, some of > the most frustrating, hair-pulling bugs that take hours (or days!) to > get to the bottom of often turn out to be dead-easy trivial mistakes > that got overlooked because they were

Re: File I/O - rawWrite issues

2013-05-08 Thread H. S. Teoh
On Thu, May 09, 2013 at 01:11:00AM +0200, Carl wrote: > Wow, I feel silly. > > In the process of making sample code I found the problem: I have > been reading the output with a text editor instead of a hex editor. > To think I spent hours on this problem... *face palm* [...] No need to be embarra

Re: File I/O - rawWrite issues

2013-05-08 Thread Idan Arye
On Wednesday, 8 May 2013 at 21:34:00 UTC, Carl wrote: I am learning D so I thought this would be the correct place for this question (I assume I am making an error, not the compiler). I am writing arrays of ubytes using rawWrite to a file. Whenever I write arrays full of numbers I have no pro

Re: File I/O - rawWrite issues

2013-05-08 Thread Carl
Wow, I feel silly. In the process of making sample code I found the problem: I have been reading the output with a text editor instead of a hex editor. To think I spent hours on this problem... *face palm* Thanks for your quick replies.

Re: File I/O - rawWrite issues

2013-05-08 Thread Ali Çehreli
On 05/08/2013 02:46 PM, Meta wrote: >> For example: >> ubyte[] data = [5, 34, 9, 45]; >> file.rawWrite(data); // OKAY >> >> ubyte[] data = [0, 0, 0, 45]; >> file.rawWrite(data); // NOT OKAY > > Since ubytes are pretty much the same as chars, True from the point of view of sizes: they are both 8-

Re: File I/O - rawWrite issues

2013-05-08 Thread Meta
For example: ubyte[] data = [5, 34, 9, 45]; file.rawWrite(data); // OKAY ubyte[] data = [0, 0, 0, 45]; file.rawWrite(data); // NOT OKAY Since ubytes are pretty much the same as chars, I think writing 0 to the file will actually write the null character, which probably isn't a good thing.

File I/O - rawWrite issues

2013-05-08 Thread Carl
I am learning D so I thought this would be the correct place for this question (I assume I am making an error, not the compiler). I am writing arrays of ubytes using rawWrite to a file. Whenever I write arrays full of numbers I have no problems, but once I write an array with zeroes I can then