[Mono-list] WriteLine of string with trailing \0's

Matt Calder mvcalder at gmail.com
Mon Aug 2 15:30:27 EDT 2010


Robert,

Indeed emitting to a file, and opening it in vi (that is, viewing
independently of the terminal) reveals the nulls. Thanks!

Matt

On Mon, Aug 2, 2010 at 3:13 PM, Robert Jordan <robertj at gmx.net> wrote:
> On 02.08.2010 20:35, Matt Calder wrote:
>> Hi,
>>
>> I had some trouble debugging code that was working with fixed length
>> strings. After a fair amount of debugging in the wrong direction, I
>> discovered the issue boiled down to the question of what should be
>> printed by this line:
>>
>> System.Console.WriteLine("[\0\0\0]");
>>
>> On mono (2.6.3) running on Ubuntu (10.04) this prints "[]". On Windows
>> this prints "[   ]". Should they be the same? and if so, which is
>> right?
>
> If you redirect the output to a file you'll find out
> that the \0 is actually emitted.
>
> However, Unix terminals do not display \0 (NULL).
>
> Robert
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


More information about the Mono-list mailing list