1
Development & Programming / Re: Pascal strings in struct for reading a resource
« Last post by tenfifty2 on Today at 11:12:19 AM »Hi Daniel!
Thank you very much for the reply!
I'm not certain how to incorporate those.
Looking at the struct I posted, I'm first of all not quite certain it's right, but let's assume it is for the purposes of this question. In C, a Str255 is really just a 256-byte string, right? Ok, so let's say we have some data in projectPath that's not quite that long. Now we want to access the next relevant field, userName. How does C know where to get it from, because according to the struct that should be 257 bytes later, right? But it's not, because projectPath is a Pascal string and starts with the length, then the data, then the \0, and then the pad, right?
Is it even possible to use a C struct to handle this data?
Thank you so much for the help!
Thank you very much for the reply!
I'm not certain how to incorporate those.
Looking at the struct I posted, I'm first of all not quite certain it's right, but let's assume it is for the purposes of this question. In C, a Str255 is really just a 256-byte string, right? Ok, so let's say we have some data in projectPath that's not quite that long. Now we want to access the next relevant field, userName. How does C know where to get it from, because according to the struct that should be 257 bytes later, right? But it's not, because projectPath is a Pascal string and starts with the length, then the data, then the \0, and then the pad, right?
Is it even possible to use a C struct to handle this data?
Thank you so much for the help!