I've used the first syntax many times, and somehow find it more intuitive.
Perhaps this is another candidate for
https://github.com/JuliaLang/julia/issues/11557 (although the use is
slightly different).

Kevin

On Mon, Jun 8, 2015 at 11:47 AM, Scott Jones <[email protected]>
wrote:

> Easy mistake, I had the same problem the first time I tried to use
> reinterpret.
> You need to do:
> reinterpret(Uint8, spaces)
>
>
> On Monday, June 8, 2015 at 3:28:14 PM UTC+2, Glen H wrote:
>>
>> Hi,
>>
>> Is there a built-in to convert a Vector{Uint32} to an ASCIIString?  The
>> Uint32 represents 8-bit ASCII.  I tried:
>>
>>
>> julia> spaces = [0x20202020,0x20202020]
>> 2-element Array{UInt32,1}:
>>  0x20202020
>>  0x20202020
>>
>>
>> julia> reinterpret(Vector{Uint8}, spaces)
>> ERROR: type does not have a canonical binary representation
>>  in reinterpret at array.jl:111
>>
>> julia> bytestring(spaces)
>> ERROR: MethodError: `bytestring` has no method matching
>> bytestring(::Array{UInt32,1})
>>
>>
>> I could write the data to an IOBuffer and then do takebuf_string but I
>> was hoping for a more efficient method.
>>
>> Glen
>>
>

Reply via email to