I have an alternative to StrPack.jl here:
https://github.com/tbreloff/CTechCommon.jl/blob/master/src/macros.jl.  If
you have a type that mimics a c-struct, you can create like:

@packedStruct immutable MyStruct
  field1::UInt8
  field2::Byte
end

and it creates some methods: read, reinterpret, etc which can convert raw
bytes into the immutable type.

I've only used it on very specific types of data, but it may work for you.

On Thu, Sep 17, 2015 at 6:04 PM, David McInnis <da...@gatohaus.com> wrote:

> I'm in the process of switching from python to julia and have gotten stuck
> for a couple of days trying to read a, for me, typical data file.
>
> In python I'd create a C-style format, open the file and read the data.
> I don't see an equivalent method in Julia.
>
> Ex:
> Using a data structure of something like:    "<4sii28s4i"
> I'd figure out the size of the structure, point to the beginning byte, and
> then unpack it.
>
> In Julia it looks like *maybe* I could make a data type to do this, but I
> can't figure out how.
> There's also StrPack.jl,  but it too is a little beyond what I understand.
>
> I work with a lot of different instruments, each with its own file
> format.  Usually I only need to read these files.  After processing I'll
> save everything into an hdf5 file.
>
> Thanks,  David.
>
>

Reply via email to