I'm starting to learn golang but come across what I hope is a simple problem.
I have a file written to in C with several structs. ie myStruct's Now I want to read one struct of data from this file.
In C I simple open a file and move the fileptr number of structs * sizeofStruct. Like this
int sizeofStruct = sizeof(myStruct)
seek(filehandle, searchNo*sizeofStruct)
read(filehandle, &data, sizeofStruct)
This doesn't seem to be as simple in Golang as "sizeof"... rather multiple conversions ending up in uintptr... something, or reflect.int32()
var spect Spectrum // struct Spectrum
const SizeOfSpectrum = unsafe.Sizeof(spect)
I was hoping SizeOfSpectrum would contain equal to sizeof(spect)
in C
Can you guys help me to get the size of a struct in an int variable?