ModularM
Modular2y ago
10 replies
graphos

Char[X] equivalent in Mojo

Hi I'm new to mojo and I'm trying to learn it.
I have a custom file format defined like so:
in C++
struct Header
{
char signature[4];
int contentSize;
}
How can I express this char[4] to a mojo struct since so far there is no Char Dtype (I could overuse uint8... but it feel very hacky)

my end goal is to read a custom binary file format directly into this struct so if you have any example on how to do that, it will be nice. I'm struggling to convert a Tensor to a mojo struct.

Thanks in advance !
Was this page helpful?